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

Re: globbing problem



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

> On Mar 3,  3:40pm, Christian Neukirchen wrote:
> } Subject: Re: globbing problem
> }
> } Manfred Lotz <manfred.lotz@xxxxxxxx> 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@xxxxxxxxx>  http://chneukirchen.org



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