zsh-workers
 help / color / mirror / code / Atom feed
From: Christian Neukirchen <chneukirchen@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: globbing problem
Date: Sun, 03 Mar 2013 20:08:50 +0100	[thread overview]
Message-ID: <8738wcnvwd.fsf@gmail.com> (raw)
In-Reply-To: <130303104236.ZM5215@torch.brasslantern.com> (Bart Schaefer's message of "Sun, 03 Mar 2013 10:42:36 -0800")

Bart Schaefer <schaefer@brasslantern.com> writes:

> On Mar 3,  3:40pm, Christian Neukirchen wrote:
> } Subject: Re: globbing problem
> }
> } Manfred Lotz <manfred.lotz@arcor.de> writes:
> } 
> } > function lsd() {
> } > 	if (( $# > 0 )); then
> } > 	  ls -d "$*"(/)
> } > 	else
> } > 	  ls -d *(/)
> } > 	fi
> } > }
> } >
> } > alias lsd='noglob lsd'
> } 
> } You need to force globbing.  Try this:
> } 
> } lsd() { local -a pat; pat=(${^*:-*}'(/N)'); ls -d ${~pat} }
> } 
> } (How to do it without a temporary variable?)
>
> By simply doing it without a temporary variable!
>
>     lsd() { ls -d ${^~*:-*}(/) }
>
> If you throw in the (N) like Christian did, "lsd notadirectory" will give
> you "./" which may or may not be what you want.

Meh, I tried to do something like ${~${^...}}} and failed. ;)

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


      reply	other threads:[~2013-03-03 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130303092908.0562f2d1__42920.4312772073$1362301372$gmane$org@arcor.com>
2013-03-03 14:40 ` Christian Neukirchen
2013-03-03 18:42   ` Bart Schaefer
2013-03-03 19:08     ` Christian Neukirchen [this message]

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=8738wcnvwd.fsf@gmail.com \
    --to=chneukirchen@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).