[GLLUG] shell script question
Fri, 12 Jul 2002 12:51:59 -0400
Sure. Try something like this:
HOMEDIR=`find /home -type d -maxdepth 1`
for TARGET in $HOMEDIR
cp /etc/skel/.config $TARGET/.config
Hope that helps!
From: Mike Rambo [mailto:firstname.lastname@example.org]
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
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?
linux-user mailing list