zsh-users
 help / color / mirror / code / Atom feed
* globbing problem
@ 2013-03-03  8:29 Manfred Lotz
  2013-03-08 14:58 ` Manfred Lotz
  0 siblings, 1 reply; 3+ messages in thread
From: Manfred Lotz @ 2013-03-03  8:29 UTC (permalink / raw)
  To: zsh-users

Hi all,
I like to define a function to display directories only. 

I like to call it with or without pattern like  in the following
examples:


# show all directories
lsd

# show all directories starting with letter m
lsd m* 


# show all directories starting with letter m or letter h
lsd m* h* 


I tried all sort of things and ended with the following which
unfortunately doesn't work either:


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


alias lsd='noglob lsd'
		

lsd without parms works fine but for instance this

$ lsd m*
ls: cannot access m*(/): No such file or directory

doesn't work.


What is my mistake?



-- 
Manfred



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: globbing problem
  2013-03-03  8:29 globbing problem Manfred Lotz
@ 2013-03-08 14:58 ` Manfred Lotz
  2013-03-08 15:36   ` Jérémie Roquet
  0 siblings, 1 reply; 3+ messages in thread
From: Manfred Lotz @ 2013-03-08 14:58 UTC (permalink / raw)
  To: zsh-users

In the meantime I saw that my question which I posted on zsh.user was
answered on zsh-workers. 

Bart, your suggestion worked like a charm. Thanks for your help. 

In the meantime I subscribed to zsh-workers which seems to be the best
to do.


-- 
Thanks again,
Manfred



On Sun, 3 Mar 2013 09:29:08 +0100
Manfred Lotz <manfred.lotz@arcor.de> wrote:

> Hi all,
> I like to define a function to display directories only. 
> 
> I like to call it with or without pattern like  in the following
> examples:
> 
> 
> # show all directories
> lsd
> 
> # show all directories starting with letter m
> lsd m* 
> 
> 
> # show all directories starting with letter m or letter h
> lsd m* h* 
> 
> 
> I tried all sort of things and ended with the following which
> unfortunately doesn't work either:
> 
> 
> function lsd() {
> 	if (( $# > 0 )); then
> 	  ls -d "$*"(/)
> 	else
> 	  ls -d *(/)
> 	fi
> }
> 
> 
> alias lsd='noglob lsd'
> 		
> 
> lsd without parms works fine but for instance this
> 
> $ lsd m*
> ls: cannot access m*(/): No such file or directory
> 
> doesn't work.
> 
> 
> What is my mistake?
> 
> 
> 



-- 
Manfred



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: globbing problem
  2013-03-08 14:58 ` Manfred Lotz
@ 2013-03-08 15:36   ` Jérémie Roquet
  0 siblings, 0 replies; 3+ messages in thread
From: Jérémie Roquet @ 2013-03-08 15:36 UTC (permalink / raw)
  To: Manfred Lotz; +Cc: zsh-users

Hi,

2013/3/8 Manfred Lotz <manfred.lotz@arcor.de>:
> In the meantime I saw that my question which I posted on zsh.user was
> answered on zsh-workers.
>
> Bart, your suggestion worked like a charm. Thanks for your help.

For future reference, the reply thread archive is available at:

http://www.zsh.org/mla/workers/2013/msg00162.html

Best regards,

-- 
Jérémie


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-08 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-03  8:29 globbing problem Manfred Lotz
2013-03-08 14:58 ` Manfred Lotz
2013-03-08 15:36   ` Jérémie Roquet

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).