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

if (()){}else{} documented?



Hi

I have been in a world of pain playing around with compound control structures

e.g. this only works as a single line (is that true?)

 if (( $1 == 4 )) { echo good } else { echo bad }

just wondered where I could read up on this?



f(){if (($1==4)){echo ok} else {echo nok} }

or

joe(){ [[ $1 > 4 ]] && echo big || echo small }

or

fred(){ if [[ $1  =~ fred ]] { echo ok} else {echo nok} }


There seems to be some arbitrariness as to when spaces are required

zzapper





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