Hi, I want to write a script to check whether an user ID is used in my server and then create that user.
If the user ID is not used, I will echo something like "OK, continue" and then continue to execute the script. Else, I will echo something like "Used, exit" and then exit the script.
As my system only have around 10 users, using grep and awk the /etc/passwd, I can check whether the UID is used. But in the shell script, when I want to
cat /etc/passwd | grep 'UID' | awk $3 and save the result to a variable, I can't do so.
Do anyone have idea on how can I write this shell script? I have no idea now since I can't save the "cat /etc/passwd" to a variable.