Note: Local general-purpose utilities such as these should be stored in the /var/opt/bin directory.
#!/bin/sh
#
# lhd - print login home directory name for a given user
#
# SYNTAX
# lhd [login]
#
# Cary Millsap, Oracle Services
# @(#)1.1 (93/05/17)
prog=`basename $0`
if [ $# -eq 0 ] ; then
login=`whoami`
elif [ $# -eq 1 ] ; then
login=$1
else
echo "Usage: $prog login" >$2
exit 2
fi
nawk -F: '$1==login {print $6}' login=$login /etc/passwd
#!/bin/sh
# grpx - print the list of users belonging to a given group
#
# Cary Millsap, Oracle Services
# @(#)1.1 (93/07/04)
prog=`basename $0`
if [ $# -ne 1 ] ; then
echo "Usage: $prog group" >&2
exit 2
fi
g=$1
# calculate group id of g
gid=`nawk -F: '$1==g {print $3}' g=$g /etc/group`
# list users whose default group id is gid
u1=`nawk -F: '$4==gid {print $1}' gid=$gid /etc/passwd`
# list users who are recorded members of g
u2=`nawk -F: '$1==g {gsub(/,/," "); print $4}' g=$g /etc/group`
# remove duplicates from the union of the two lists
echo $u1 $u2 | tr " " "\012" | sort | uniq | tr "\012" " "
echo
$ for u in `grpx clerk` ; do
> cp /etc/skel/.profile `lhd $u`
> done