Hello,
I administer several computers used by students for course work. I
have a little ksh script that locks the student accounts and replaces
their home directories with clean ones. The ksh script is:
#! /bin/ksh
# locks user's accounts
#
# use this to get user names
## cut -f1 -d: /etc/passwd grep string > user_list
## edit user_list to included desired users
#
# run the script
## lock user_list
#
for i in `cat ${1}`
do
# The first part locks the passwd of users in user_list
passwd -l $i
grep $i /etc/shadow
#
# This second part will remove the users' files
/bin/rm -rf ~$i
#
# This third part restores the default init files to the
# user accounts
mkdir -p ~$i
cp /etc/stdcshrc ~$i/.cshrc
cp /etc/stdlogin ~$i/.login
cp /etc/stdprofile ~$i/.profile
chown -R $i.user ~$i
ls -laFd ~$i
ls -laF ~$i
echo ""
echo ""
done
This works well for ksh but under bash none of the lines containing
~$i work. I get error messages like "Cannot access ~username: No such
file or dirctory". I've tried every form of quoting and escaping I
can think of, and I scanned the manual and HOWTOs but I can't get
"~$i" to work under bash. What am I missing?
Thanks,
Don
--
Department of Chemistry 547 NSC
Georgia State University ph: (404) 651-3580
Atlanta, Ga. 30302 fax:(404) 651-1416