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
1 merge request!154Add script to move between groups
......@@ -16,9 +16,7 @@ elif [[ ! " ${group_options[*]} " =~ [[:space:]]${group_to}[[:space:]] ]]; then
exit 1
fi
getent passwd "$user" > /dev/null 2&>1
if [[ $? -ne 0 ]]; then
if ! getent passwd "$user" > /dev/null 2>&1; then
echo "The user $user does not exist"
exit 1
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