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

Re: PATCH: fixing ${1+"$@"} when word-splitting



Wayne Davison wrote:
> --LyciRD1jyfeSSjG0
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Sun, Feb 12, 2006 at 08:26:17PM +0000, Peter Stephenson wrote:
> > Frankly, it's such a mess at the moment that I think any practical
> > improvement is a good thing.
> 
> OK.  Here's something even better.  This appears to make us totally
> compatible with bash.

This looks extremelly promising (particularly since it still passes all
the tests as modified) but there is one glitch which turned up from the
function is-at-least, which is called liberally from my .zshrc.
It traces down to:

fn() {
  local IFS=.-
  print -l ${=1:-1.2}
}

With no arguments, this used to give

1
2

but now gives

1.2

With 1.2 passed as an argument instead it always gives the first
behaviour.  I suspect this is the wrong behaviour since bash gives me:

$ fn() { local IFS=.-; echo ${1:-1.2}; }
$ fn
1 2

which suggests the argument should be split (as it's unquoted).
(Naively, I would also expect an unquoted 1.2 to be split in the same way
whether it came from the positional parameter or the default.)

Anyway, I expect that's yet another complexity.

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