Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible
by tempodox on Friday June 26, 2020 @06:51AM
(#23650588)
> …left and single operands…
That's false:
x='foo bar'; [ $x = 'foo bar' ]; echo $?
-bash: [: too many arguments
x='foo bar'; [ "$x" = 'foo bar' ]; echo $?
0
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible
by gravitas on Friday June 26, 2020 @08:37AM
(#23651281)
As I replied to your other comment, you cannot just replace [[ with [ and get the same behaviour. If you use the actual bash builtin [[ which we're discussing, it works as expected. Also, please use == when comparing, = is an assignment operator (in almost every programming language).
Plus, left and single operands, in bash conditions, don't require quoting, so a lean style is actually not to use them at all.