--- Mark Evans
Hi all,
How would I write a script that only affected certain groups?
Trying to think of an example, how could I run:
rm /home/*/file_to_delete
only on the home directories of folk who belong to the 'pupil' group.
One command I run is find /home -name '*' -maxdepth 1 -exec cp /home/template/file_to_copy '{}'/new_file ';'
Can I build a "where user is in group 'pupils'" into that somehow?
You could try something like "find /home -group pupil"...
Hmm. I've got a bit stuck. I should have said the words 'RedHat'. It uses User Groups as primary groups - so all these home directories do not belong to the 'pupil' group. Any other ideas? I'm playing with cat, grep, sed and find to try to extract the names next to the pupil group in /etc/groups - but I'm messing up the pipes and the '>' etc. I am also trying to work out how to strip off useless info from a line from /etc/group, and then run all words between commas individually into find. I'm still experimenting. Please let me know any pointers, or even better - give examples. I think the scripting (potential - for me) of Linux is _such_ a big selling point. I can see what I want to do with it, and it's great when you figure out a little script to go off and do it for you. It is _so_ powerful, and makes admin tasks a breeze (once you've figured out the syntax). Thanks for responses so far. -- Matt __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/