PRIMARY CATEGORY → SCRIPTING SHELLS BASH $ export -- EDITOR=nvim $ C-x C-e foo(){ local -a -- _shells=() local -- IFS=: _shell= while IFS= read -r _shell do [[ $_shell == *sh ]] || continue _shells+=("${_shell##*/}") done < /etc/shells printf "%s\n" "${_shells[*]}" } $ foo sh:bash:bash:rbash:rbash:sh:dash:dash POSIX