From 53c00ac631a7b316219cd9a889551fda4554003b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Feb 2022 12:50:54 +0530 Subject: [PATCH] Fix detection of login shell from passwd --- shell-integration/ssh/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index 6e6f79a0a..476dd7cee 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -125,7 +125,7 @@ using_id() { if [ -n "$cmd" ]; then output=$($cmd -P $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 @@ -137,7 +137,7 @@ using_passwd() { if [ -n "$cmd" ]; then output=$($cmd "^$USER:" /etc/passwd 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