zsh-users
 help / color / mirror / code / Atom feed
* expandig var values at the command line
@ 1999-08-20 21:34 dado
       [not found] ` <upv0i6qfp.fsf@TimesTen.com>
  0 siblings, 1 reply; 3+ messages in thread
From: dado @ 1999-08-20 21:34 UTC (permalink / raw)
  To: zsh users list

I tcsh I use to have a variable set to a list of directories:

set dirs = '{dir1,dir2,dir3,...,dirN}'

then I would do:

ls /path/path/$dirs/path

and I would get the contents of those directories.

I can't get similar behavior in zsh.
It is expanding the variable once, and treating its content as a single
string
instead of expanding to the names of each directory.

Any idea how I can get that to work?

Thanks.

--
____________________________________________________________________________
d a d o    f e i g e n b l a t t                       direct (650) 846-8386
dado@pdi.com - Technical Lighter                   front desk (650) 846-8100
PDI - Palo Alto, CA                                       fax (650) 846-8101




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: expandig var values at the command line
       [not found] ` <upv0i6qfp.fsf@TimesTen.com>
@ 1999-08-20 23:25   ` dado
       [not found]     ` <uwvuqxa9q.fsf@TimesTen.com>
  0 siblings, 1 reply; 3+ messages in thread
From: dado @ 1999-08-20 23:25 UTC (permalink / raw)
  To: David Aspinwall, zsh users list

David Aspinwall wrote:

> > ls /path/path/$dirs/path
>
> try
> ls /path/path/$^dirs/path

dado@saci:shrksq1150s49:~a_shot_dir 178 -> ll
../s$^shots/adbs/startup.adb
UX:ls: ERROR: Cannot access
../s{2,4,23,25,27,29,31,33,35,36,38,40,43,48,49,50}/adbs/startup.adb: No
such file or directory
dado@saci:shrksq1150s49:~a_shot_dir 179 -> ll
../s{2,4,23,25,27,29,31,33,35,36,38,40,43,48,49,50}/adbs/startup.adb
-r--r--r--    1 root     sys         2176 Aug 20 14:41
../s2/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:31
../s23/adbs/startup.adb
-r--r--r--    1 root     sys          688 Aug 12 16:30
../s25/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:32
../s27/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:32
../s29/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:32
../s31/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:32
../s33/adbs/startup.adb
-rw-r--r--    1 dado     sys         2605 Aug 18 10:30
../s35/adbs/startup.adb
-rw-r--r--    1 dado     users        686 Aug 16 20:17
../s36/adbs/startup.adb
-rw-r--r--    1 dado     users        686 Aug 12 21:51
../s38/adbs/startup.adb
-r--r--r--    1 root     sys          688 Jul 12 12:31
../s4/adbs/startup.adb
-r--r--r--    1 root     sys         2623 Aug 16 16:23
../s40/adbs/startup.adb
-rw-r--r--    1 dado     users       1602 Aug 18 16:22
../s43/adbs/startup.adb
-r--r--r--    1 root     sys          910 Jul 28 11:41
../s48/adbs/startup.adb
-r--r--r--    1 root     sys         2804 Aug 20 14:43
../s49/adbs/startup.adb
-r--r--r--    1 root     sys         2255 Aug 20 14:43
../s50/adbs/startup.adb


As you can see, the expanded variable works fine.
But its value is still not being expanded.

What is the caret for? I don't know this notation.

Thanks.

--
____________________________________________________________________________
d a d o    f e i g e n b l a t t                       direct (650) 846-8386
dado@pdi.com - Technical Lighter                   front desk (650) 846-8100
PDI - Palo Alto, CA                                       fax (650) 846-8101




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: expandig var values at the command line
       [not found]     ` <uwvuqxa9q.fsf@TimesTen.com>
@ 1999-08-21  1:21       ` dado
  0 siblings, 0 replies; 3+ messages in thread
From: dado @ 1999-08-21  1:21 UTC (permalink / raw)
  To: David Aspinwall, zsh users list

David Aspinwall wrote:

> > What is the caret for? I don't know this notation.
>
> According to the man page:
>           ${^spec}
>                Turn on the RC_EXPAND_PARAM option for the evalua-
>                tion  of  spec;  if the ^ is doubled, turn it off.
>                When this option is set, array expansions  of  the
>                form foo${xx}bar, where the parameter xx is set to
>                (a b c),  are  substituted  with  fooabar  foobbar
>                foocbar instead of the default fooa b cbar.
>
> I don't know why it isn't working for you.

I got it!
This is because in tcsh I was wrapping the dir names with {a,b,c}
and in zsh it uses parentheses and spaces, (a b c).

Now it is working.

Thanks.

--
____________________________________________________________________________
d a d o    f e i g e n b l a t t                       direct (650) 846-8386
dado@pdi.com - Technical Lighter                   front desk (650) 846-8100
PDI - Palo Alto, CA                                       fax (650) 846-8101




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-08-21  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-20 21:34 expandig var values at the command line dado
     [not found] ` <upv0i6qfp.fsf@TimesTen.com>
1999-08-20 23:25   ` dado
     [not found]     ` <uwvuqxa9q.fsf@TimesTen.com>
1999-08-21  1:21       ` dado

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).