ssh kitten: Look in common locations for login shell if it is not in PATH

This commit is contained in:
Kovid Goyal 2022-05-28 11:29:09 +05:30
parent 7f69381221
commit 4c74462763
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -198,6 +198,20 @@ prepare_for_exec() {
install_kitty_bootstrap
[ -n "$login_shell" ] || using_getent || using_id || using_python || using_perl || using_passwd || using_shell_env || login_shell="sh"
case "$login_shell" in
/*) ;;
*)
if ! command -v "$login_shell" > /dev/null 2> /dev/null; then
for i in /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin
do
if [ -x "$i/$login_shell" ]; then
login_shell="$i/$login_shell"
break;
fi
done
fi
;;
esac
shell_name=$(command basename $login_shell)
[ -n "$login_cwd" ] && cd "$login_cwd"
}