I am realitively new to bash scripting, but have created this from my intense googling
I am attempting to create a bash script to run on Ubuntu that will check the user list and find any users that aren’t in a specified list. I have written this so far:
Cat /etc/passwd | grep -o -P ‘.{0,40}:1[0-9][0-9][0-9].{0,0}.’ | cut -d: -f1
views passwd file, then finds only the lines with a user ID of 1000 or above, and everything before the userID of each line is piped into cut which removes all except the username of each user.
I then want to have the script check a file for usernames I specify (probably copied from a list) and compare each to the output of the above. Removing all usernames specified.
So for instance:
I have users John, Ben and Tom on my computer If I put John and Ben in the file the script is accessing, it should output Tom since he is not specified
How would I go about doing this?
if
statements in your program