zsh-users
 help / color / mirror / code / Atom feed
* if (()){}else{} documented?
@ 2021-04-20 14:40 david
  2021-04-20 15:19 ` Marc Chantreux
  2021-04-20 15:33 ` Lawrence Velázquez
  0 siblings, 2 replies; 12+ messages in thread
From: david @ 2021-04-20 14:40 UTC (permalink / raw)
  To: zsh-users

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



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-04-21 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 14:40 if (()){}else{} documented? david
2021-04-20 15:19 ` Marc Chantreux
2021-04-20 15:28   ` Lawrence Velázquez
2021-04-20 15:32     ` Marc Chantreux
2021-04-21  8:46   ` zzapper
2021-04-21 10:41     ` Marc Chantreux
2021-04-21 12:32       ` zzapper
2021-04-21 14:59         ` Marc Chantreux
2021-04-21 15:01         ` Marc Chantreux
2021-04-21 13:57     ` Bart Schaefer
2021-04-20 15:33 ` Lawrence Velázquez
2021-04-21  9:16   ` zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).