[GLLUG] shell script question
Melson, Paul
PMelson@sequoianet.com
Fri, 12 Jul 2002 12:51:59 -0400
Sure. Try something like this:
#!/bin/sh
HOMEDIR=`find /home -type d -maxdepth 1`
for TARGET in $HOMEDIR
do
cp /etc/skel/.config $TARGET/.config
done
Hope that helps!
PaulM
-----Original Message-----
From: Mike Rambo [mailto:mrambo@lsd.k12.mi.us]
Sent: Friday, July 12, 2002 12:21 PM
To: GLLUG List
Subject: [GLLUG] shell script question
I'm trying to wite a bash shell script that will place a configuration
file in each users home directory. I can come up with a list of targets
by using...
ls /home | grep drwx | cut -d : -f 2 | cut -d \ -f 2
...which I can direct to a file or whatever. Is there a way to take the
resulting list and assign or use each item sequentially as a variable in
a statement something like...
cp file-i-want /home/$TARGET
...to copy this file to potentially many user directories at one time?
Thanks
--
Mike Rambo
mrambo@lsd.k12.mi.us
_______________________________________________
linux-user mailing list
linux-user@egr.msu.edu
http://www.egr.msu.edu/mailman/listinfo/linux-user