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

Re: assigning parameters and globbing



Vincent Lefevre wrote:
> What do you suggest to set an environment BLAH to *([-1]) or something
> similar (globbing that leads to a single filename -- which may contain
> special characters)?

You can, if you like, use glob_assign:

  setopt GLOB_ASSIGN
  export BLAH
  BLAH=*([-1])

but I'd probably use an intermediate array.

  local -a files
  files=(*)
  export BLAH=${files[-1]}

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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