Add tests for the individual login_shell detection functions

This commit is contained in:
Kovid Goyal
2022-02-24 13:28:34 +05:30
parent 3fb7ce7100
commit c00e8b1709
2 changed files with 27 additions and 8 deletions

View File

@@ -87,9 +87,6 @@ if [ -x "$(command -v tic)" ]; then
if [ "$rc" != "0" ]; then die "$tic_out"; fi
fi
# If a command was passed to SSH execute it here
EXEC_CMD
shell_integration_dir="$HOME/SHELL_INTEGRATION_DIR"
login_shell_is_ok() {
@@ -113,7 +110,7 @@ using_getent() {
if [ -n "$cmd" ]; then
output=$($cmd passwd $USER 2>/dev/null)
if [ $? = 0 ]; then
login_shell=$(echo $output | cut -d: -f7);
login_shell=$(echo $output | grep -o '[^:]*$');
if login_shell_is_ok; then return 0; fi
fi
fi
@@ -162,6 +159,9 @@ execute_with_python() {
return 1;
}
# If a command was passed to SSH execute it here
EXEC_CMD
LOGIN_SHELL="OVERRIDE_LOGIN_SHELL"
if [ -n "$LOGIN_SHELL" ]; then
login_shell="$LOGIN_SHELL"