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

Re: grammar triviality with '&&'



On 2015-03-02 11:19:25 -0800, Bart Schaefer wrote:
> % alias and='(){ return $? } && '
> 
> (Trailing space thrown in to expand aliases again in the next word.)

I've found a bug:

% alias '&&=(){ return $? } && '
% && echo OK
zsh: parse error near `&&'

Since && will be replaced by the alias, there's no reason to get
a parsing error. The zshexpn(1) man page says:

    Alias Expansion
        Aliases are expanded immediately before the command line is
        parsed as explained under Aliasing in zshmisc(1).

Note the "before the command line is parsed".

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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