Created
March 11, 2015 00:43
-
-
Save lukrizal/7a9decf109afa34d7f35 to your computer and use it in GitHub Desktop.
Useful Bash Scripts
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
#!/usr/bin/env bash | |
# Example | |
# $ . checking-user-if-exist.sh root | |
q=$(id -u $1) | |
re='^[0-9]+$' | |
if ! [[ $q =~ $re ]] ; then | |
echo "User $1 not found!" >&2; | |
fi | |
if [[ $q =~ $re ]] ; then | |
echo "User $1 found!" >&2; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment