Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
if (()){}else{} documented?
- X-seq: zsh-users 26678
- From: david <zsh@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: if (()){}else{} documented?
- Date: Tue, 20 Apr 2021 15:40:38 +0100
- Archived-at: <https://zsh.org/users/26678>
- List-id: <zsh-users.zsh.org>
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