Skip to content
Snippets Groups Projects
Commit 28c8c81f authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

refactor: check exit code of command directly

parent f70d88a1
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,7 @@ elif [[ ! " ${group_options[*]} " =~ [[:space:]]${group_to}[[:space:]] ]]; then ...@@ -16,9 +16,7 @@ elif [[ ! " ${group_options[*]} " =~ [[:space:]]${group_to}[[:space:]] ]]; then
exit 1 exit 1
fi fi
getent passwd "$user" > /dev/null 2&>1 if ! getent passwd "$user" > /dev/null 2>&1; then
if [[ $? -ne 0 ]]; then
echo "The user $user does not exist" echo "The user $user does not exist"
exit 1 exit 1
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment