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 15:40:57 +0100	[thread overview]
Message-ID: <87bob0o8au.fsf@gmail.com> (raw)
In-Reply-To: <20130303092908.0562f2d1__42920.4312772073$1362301372$gmane$org@arcor.com> (Manfred Lotz's message of "Sun, 3 Mar 2013 09:29:08 +0100")

Manfred Lotz <manfred.lotz@arcor.de> writes:

> function lsd() {
> 	if (( $# > 0 )); then
> 	  ls -d "$*"(/)
> 	else
> 	  ls -d *(/)
> 	fi
> }
>
>
> alias lsd='noglob lsd'

> $ lsd m*
> ls: cannot access m*(/): No such file or directory
>
> doesn't work.
>
> What is my mistake?

You need to force globbing.  Try this:

lsd() { local -a pat; pat=(${^*:-*}'(/N)'); ls -d ${~pat} }

(How to do it without a temporary variable?)

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


       reply	other threads:[~2013-03-03 14:41 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 [this message]
2013-03-03 18:42   ` Bart Schaefer
2013-03-03 19:08     ` Christian Neukirchen

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=87bob0o8au.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).