Quote:
Originally Posted by cylon
for D in $(cat /etc/passwd | awk -F : '{print $6}' | sort -u) ; do
ls -d "$D" >/dev/null 2>&1 || echo "$D" 1>&2 ;
done
|
If you try the script with
for D in $(cat /etc/passwd | awk -F : '{print $6}' | sort -u) ; do
echo $D
done
you will see that the for loop is giving the /etc/passwd to AWK. AWK prints column number 6 which has the Home Directory included.
now look at the ls command. This will try to list the entries in column number 6 as directories and throw the ouptput away. if this fails the echo command is in charge and it will output the name .
The conclusion is that the script shows non existing home directories
Regard Norbert
EDIT: remove typos