@Reptorian You made so many edits!
Switch would make the code neater. You are missing the case item value that the variable must match and the optional default command when no conditions are met. I suppose a break for each case could be implied.
switch variable
case item command
case item command
default command
done
Bonus for fun, since fi
is the counterpart of if
, make it hctiws
for switch
.
Edit: Or bign
.
@David_Tschumperle fi
no longer is a shortcut, but in the reference document, fi
refers to itself as a shortcut. @grosgood’s tutorial refers to endif
, which no longer exists.