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

grammar



I was going thru some old stuff and I came across something like this:

% if [[ $path ]] echo $path

... it works, which makes me uncomfortable because it ain't good grammar.  Or is it?  Without the usual:

if [[ ]]; then

fi

... I'm surprised that it works.  Perhaps it ends up being exactly like:

[[ $path ]] && echo $path     ?

 Should I view the 'then ... fi' grammar  as just optional code block controllers?

And:

(( length > max )) && length=max

... is there a shorter syntax for that?  I'll bet there is.





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