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

Re: globbing and quoting in a function

This business with gmane double-posting to both zsh-users and zsh-workers
is getting annoying.  As gmane is apparently not clever enough to get this
right by themselves, would you gmane users please be polite and trim off
one of the two newsgroups when posting?  (I don't know what names gmane
gives to their groups that are gatewayed to the zsh lists.)

On Jul 20,  7:24am, Stefan Reichör wrote:
} I'd like to call:
} lsnew *
} lsnew a*
} Is there an easy way to do it in zsh?

Yes.  It's been answered in the previous postings.

  function lsnew { ls -tr -dl $~1(om[1,30]) }
  alias lsnew='noglob lsnew'

Once the alias has been defined, you must not attempt to re-define the
lsnew function unless you do so using the "function" keyword as above.
The existence of the alias causes the
  lsnew() { ... }
syntax to do something different from what you would expect.

A drawback to the above is that you cannot do

  lsnew *(.)

because that expands to

  ls -tr -dl *(.)(om[1,30])

and two sets of glob qualifiers don't mix.

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