Skip to main content
4 events
when toggle format what by license comment
Mar 5 at 22:05 comment added vbwx I prefer this way as well. It has the advantage that these "faux booleans" can be used in different ways with Bash. If $bool is set to either 1 or a null string, ((bool)) works just like [[ $bool ]], which is the same as [[ -n $bool ]]. To test for a false value, ((! bool)) is equal to [[ ! $bool ]]. It can even be used for parameter expansion such as echo "${bool:+This variable is true}". The values 0 and 1 do not provide this much flexibility.
Mar 20, 2021 at 22:15 history edited yolenoyer CC BY-SA 4.0
added 108 characters in body
Mar 20, 2021 at 21:59 history edited yolenoyer CC BY-SA 4.0
added 2 characters in body
Mar 20, 2021 at 17:41 history answered yolenoyer CC BY-SA 4.0