You seem on the ball so I won't spoon-feed you a script, but here are some pointers:
You're using
awkincorrectly. Try this instead:awk -F: '$3%2==0 && $3>1000 && $3!=65534{print $6}' /etc/passwdThere's no need for
cat.Use your
awkoutput as the input to yourreadloop, ie.while read USER_HOME_DIR ; do ... ; done < $(awk...).Add a check in your
awkprogram to limit it to UID's above 1000, or you will inadvertently perform your copy for many system users.Note that in #1 above, I changed your
$1to$6in order to pull the user's home directory instead of the user's name.I just noticed on my debian machine that there exists a 'nobody' user with UID 65534, so you may need to account for that. I modified the
awkstatement in #1 accordingly.