zsh-workers
 help / color / mirror / code / Atom feed
* Re: globbing and quoting in a function
       [not found]     ` <1050720035400.ZM7204@candle.brasslantern.com>
@ 2005-07-20  5:24       ` Stefan Reichör
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Reichör @ 2005-07-20  5:24 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

Bart Schaefer <schaefer@brasslantern.com> writes:

> On Jul 19,  8:29am, Wayne Davison wrote:
> } Subject: Re: globbing and quoting in a function
> }
> }     alias lsnew='noglob lsnew'
> } 
> } (I vaguely recall that having an alias call a function of the same
> } name might cause a problem in some older zsh versions, but it works
> } fine in 4.2.5.)
>
> The "problem" is still there.  See the last few paragraphs of FAQ
> question 2.3.

So my question is still open:

Consider the following command:
ls -tr -dl *(om[1,30])

Now I would like to create an alias/or a function/or whatever to make
the * variable.

I'd like to call:
lsnew *
lsnew a*


Is there an easy way to do it in zsh?

The only idea that I have at the moment is to create a script on the
fly and execute it.

Other ideas?



Stefan.


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

* Re: globbing and quoting in a function
       [not found] ` <20050719145955.GD3593@localhost.localdomain>
@ 2005-07-19 15:35   ` Stefan Reichör
       [not found]   ` <20050719152933.GA23645@blorf.net>
  1 sibling, 0 replies; 2+ messages in thread
From: Stefan Reichör @ 2005-07-19 15:35 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

Doug Kearns <dougkearns@gmail.com> writes:

> On Tue, Jul 19, 2005 at 04:27:32PM +0200, Stefan Reichör wrote:
>> Hi!
>> 
>> I use the following alias to show the last 30 files changed:
>> 
>> alias lsnew='ls -tr -dl *(om[1,30])'
>> 
>> 
>> Now I want to convert it to a function to specify the '*' as
>> parameter:
>> 
>> I tried the following, but the $1 is not combined with the glob
>> modifier.
>> 
>> function lsnew () {
>>     ls -tr -dl $1(om[1,30])
>
>       ls -tr -dl $~1(om[1,30])
>
>> }
>> 
>> 
>> So is there a way to make 'lsnew a*' work?
>
> You'll need to quote the * as well. For example,
>
> lsnew a\*

That does not work as expected:
lsnew:1: no matches found: a*(om[1,30])

I would like to see all files, starting with a.
The quoted \* seems to match the *.


Stefan.


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

end of thread, other threads:[~2005-07-20  5:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m0k6jmna5n.fsf@msc-ge.com>
     [not found] ` <20050719145955.GD3593@localhost.localdomain>
2005-07-19 15:35   ` globbing and quoting in a function Stefan Reichör
     [not found]   ` <20050719152933.GA23645@blorf.net>
     [not found]     ` <1050720035400.ZM7204@candle.brasslantern.com>
2005-07-20  5:24       ` Stefan Reichör

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