Fix detection of login shell from passwd

This commit is contained in:
Kovid Goyal
2022-02-24 12:50:54 +05:30
parent 99d0c2d846
commit 53c00ac631

View File

@@ -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