a little shell problem

John Olson plug-discuss@lists.plug.phoenix.az.us
Fri, 11 Oct 2002 16:58:42 -0700


This is kind of a kluge, but it works:

CLIENTS="`echo ~user1`
`echo ~user2`"

 for X in $CLIENTS ; do
   ls $X
 done

Note that's a back-tick, not a single quote.

-----Original Message-----
From: plug-discuss-admin@lists.plug.phoenix.az.us
[mailto:plug-discuss-admin@lists.plug.phoenix.az.us] On Behalf Of Lynn
David Newton
Sent: Friday, October 11, 2002 10:49 AM
To: Phoenix Linux Users Group
Subject: a little shell problem



I'm writing a script (in ksh, not bash, but I believe
the problem is the same in either shell) where I have
to write some files to a number of login directories.
Putting a list of targets in a variable near the top
like this turns off tilde expansion:

CLIENTS="~joe/foo
         ~blow/foo
         ~schmo/blah"

The list of clients is potentially rather long, and I'd
rather set it in an easily modifiable list near the
front of the script and then later be able to do

for client in $CLIENTS
do
  stuff
done

rather than

for client in ~joe/foo \
              ~blow/foo \
	      ~shmo/blah
do
  stuff
done

Surely this is an easy thing, but I've got a mental
block. Can someone help me get my blinders off? Thanks.

-- 
Lynn David Newton
Phoenix, AZ
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change  you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss