LDP/LDP/guide/docbook/abs-guide/allprofs.sh

20 lines
604 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2008-07-20 23:16:47 +00:00
# allprofs.sh: Print all user profiles.
2001-07-10 14:25:50 +00:00
# This script written by Heiner Steven, and modified by the document author.
2001-10-15 14:21:41 +00:00
FILE=.bashrc # File containing user profile,
#+ was ".profile" in original script.
2001-07-10 14:25:50 +00:00
for home in `awk -F: '{print $6}' /etc/passwd`
do
[ -d "$home" ] || continue # If no home directory, go to next.
[ -r "$home" ] || continue # If not readable, go to next.
(cd $home; [ -e $FILE ] && less $FILE)
2001-07-10 14:25:50 +00:00
done
2001-10-15 14:21:41 +00:00
# When script terminates, there is no need to 'cd' back to original directory,
#+ because 'cd $home' takes place in a subshell.
2001-07-10 14:25:50 +00:00
exit 0