Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: globbing problem



Manfred Lotz <manfred.lotz@xxxxxxxx> 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@xxxxxxxxx>  http://chneukirchen.org



Messages sorted by: Reverse Date, Date, Thread, Author