Simon scribed;
Why is the following script ripping out every directory rather than just those in 'studentfile'
#!/bin/bash
while read name; do
cd $name
rm -fvr *
cd ..
rmdir $name
done < studentlist
Repeat after me: "Never use a star with rm -r !"
In your script what will happen if there is a name in the list that doesn't exist as a directory?
cd $name will fail leaving you in the current directory.
rm -r * will then remove everything in the current directory......
as Vino said do this;
while read name; do rm -fvr $name done < studentlist
much safer.
HTH
P
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
