SyntaxFix
Write A Post
Hire A Developer
Questions
By far the simplest solution:
if id -u "$user" >/dev/null 2>&1; then echo 'user exists' else echo 'user missing' fi
The >/dev/null 2>&1 can be shortened to &>/dev/null in Bash.
>/dev/null 2>&1
&>/dev/null