I'm trying to write a script is suppose to parse a file to find and print the usernames for all non-system accounts. If the account has a non-standard (i.e., non-bash) shell, then the script should mark that username with an asterisk. I am trying to have it ignore all system accounts, which are accounts that have a user ID of less than 1000. If the account has an ID of at least 1000, then you will print the username of that account. If the shell for that account is not /bin/bash, then also print an asterisk after the name to indicate that it is non-standard.
I am new to bash and really struggle with some of the syntax. Any help would be greatly appreciated.
#!/bin/bash
count=$(cat /etc/passwd | awk -F: '{print $3}')
if [[ $count -ge 1000 ]]; then
cat /etc/passwd | awk -F: '{print $1}'
fi
Is there an easier way to do this?