zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>,
	zsh-users@math.gatech.edu
Subject: Re: globbing for links in pathnames
Date: Thu, 4 Feb 1999 21:07:55 -0800	[thread overview]
Message-ID: <990204210755.ZM20448@candle.brasslantern.com> (raw)

On Feb 4, 11:22pm, Sweth Chandramouli wrote:
} Subject: Re: globbing for links in pathnames
}
} On Thu, Feb 04, 1999 at 04:56:00PM -0800, Bart Schaefer wrote:
} > zsh% setopt globassign
} > zsh% x=*(@) eval 'ls $^x/man(/)'
} 
} 	according to the docs, globassign is deprecated, because
} globbing is done implicitly so long as the parameter is explicitly
} set to an array.

D'oh!  I was distracted by attempting to get globbing to happen in the
right-side of ${x::=*(@)}, discovered that glob_assign wouldn't do it,
and then just left it there and typed the other solution.

} so it should end up something like the following:
} 
} x=(pkgs/*(@)) ; ls -d ${^x}/man(/)

The reason I used the eval was to avoid having x remain set after the
command completes.  `x=(*(@)) eval ...` will unset x again at the end
of the eval, and won't destroy any existing value of x.

zsh% x=START ; x=NEXT eval 'echo $x' ; echo $x
NEXT
START

} 	-- sweth, who is now wondering if he could combine this
} with the earlier discussion about nested expansion to make a single
} inscrutable argument to ls -d to achieve this via (P).

The new (P) flag won't help with this; it only does an extra level of
variable name lookup.

There's no way to get globbing to happen inside the ${...} expression
without using a command substitution.  So you could do

	ls -d pkgs/${^$(echo *(@))}/man(/)

but that actually has to fork a subshell for the $(...) so it's not as
efficient as the eval.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


             reply	other threads:[~1999-02-05  5:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-05  5:07 Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-02-05 17:14 Bart Schaefer
1999-02-05 14:24 Andrew Gallagher
1999-02-05 12:06 Phil Pennock
1999-02-05  4:22 Sweth Chandramouli
1999-02-05  4:11 Sweth Chandramouli
1999-02-05  0:56 Bart Schaefer
1999-02-05  0:23 Steve Talley
1999-02-04 23:27 Sweth Chandramouli
1999-02-04 22:36 Steve Talley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990204210755.ZM20448@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).