Created
October 12, 2017 13:31
-
-
Save geekbass/ad43f0ea1051d660c71fcf9163db0080 to your computer and use it in GitHub Desktop.
Check to see if a User exists. If so break with the check on move on.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COUNTER=0 | |
USER='blah' | |
while [ $COUNTER -lt 10 ]; do | |
if [ `id -u $USER 2>/dev/null || echo -1` -ge 0 ]; then | |
echo 'User Found... Moving on...' | |
break | |
else | |
echo 'User Not Found... Retrying...' | |
sleep 2 | |
fi | |
let COUNTER=COUNTER+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment