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

Re: dumb question about parameter expansion



Hi Sergio,

2012/10/11 sergio <mailbox@xxxxxxxxxxxxx>:
> Looks like it's dumb question, but I can't understand this.
>
> % zsh -f
> % l='ls'
> % o='-l -h'
> % $l $o
> ls: invalid option -- ' '
> Try `ls --help' for more information.
>
> % ls -l -h
> total 512
> drwxr-x---  2 sergio sergio ...

Unlike other shells, zsh doesn't split unquoted variables by default.
If you want that behaviour, you can either:
 - “setopt shwordsplit” to have it by default, or
 - use “$l $=o” to have it selectively (the “=” forces the split).

Best regards,

-- 
Jérémie



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