I want to create a script that change a username. I want to check if the user is not a system user. My idea is to check /etc/passwd and pick only users with an ID between 1000 and 60000 and users that have a /home directory like
user:x:1005:1021::/home/user:/bin/sh
My grep command for now is like
egrep -E '1[0-9]{3}.*/home' /etc/passwd
As you can see, it doesn't match my [1000-60000] pattern nor the name
grep -E
is the same thing asegrep
. There's no point in using both (egrep -E
), just usegrep -E
.