assume grep is present

This commit is contained in:
Kovid Goyal 2022-03-04 10:13:23 +05:30
parent c3ce0c26e7
commit 108ccffcd8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -184,9 +184,8 @@ using_id() {
} }
using_passwd() { using_passwd() {
cmd=$(command -v grep) if [ -f "/etc/passwd" -a -r "/etc/passwd" ]; then
if [ -n "$cmd" ]; then output=$(grep "^$USER:" /etc/passwd 2>/dev/null)
output=$($cmd "^$USER:" /etc/passwd 2>/dev/null)
if [ $? = 0 ]; then if [ $? = 0 ]; then
login_shell=$(echo $output | parse_passwd_record); login_shell=$(echo $output | parse_passwd_record);
if login_shell_is_ok; then return 0; fi if login_shell_is_ok; then return 0; fi