Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: grammar triviality with '&&'
On Mar 2, 2015 3:17 AM, "Peter Stephenson" <p.stephenson@xxxxxxxxxxx> wrote:
>
>
> % andfn() {
> integer stat=$?
> (( $stat > 0 )) && return $stat
> return 0
> }
> % alias and='andfn &&'
% alias and='(){ return $? } && '
(Trailing space thrown in to expand aliases again in the next word.)
Heck, for most purposes you don't even need $? preserved:
% alias and='(( $? )) || '
Heck #2, let's just invent some new operators:
alias -g @@=';(){ return $? } && '
alias -g ::=';(){ return $? } || '
Messages sorted by:
Reverse Date,
Date,
Thread,
Author