Created
April 25, 2017 11:55
-
-
Save pyratebeard/ff19cefbe502ceaf61c97dc27c786aeb to your computer and use it in GitHub Desktop.
Search /etc/passwd for usernames
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 - | |
for user in $* ; do | |
user_search=$(grep -c $user /etc/passwd) | |
case $user_search in | |
0) printf "User '$user' does not exist\n" ;; | |
1) printf "User '$user' does exist\n" ;; | |
*) printf "Something went wrong\n" ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment