Created
March 26, 2015 13:16
-
-
Save briantissue/55151baf5adad45fd6d2 to your computer and use it in GitHub Desktop.
Find Users W/User Input
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 | |
read -p "Enter UserID: " userid | |
touch find-$userid.txt | |
for HOST in `cat ../server_list|grep -v ^#`; do echo ${HOST}; ssh ${HOST} "hostname;cat /etc/passwd | grep -i $userid"; echo ""; done >> find-$ | |
for HOST in `cat ../server_list2|grep -v ^#`; do echo ${HOST}; ssh ${HOST} "hostname;cat /etc/passwd |grep -i $userid"; echo ""; done >$ | |
read -p "Press [Enter] key to view the number of servers $userid resides..." | |
cat find-$userid.txt | grep -i $userid | wc -l | |
read -p "End of script..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment