Remix.run Logo
stabbles 6 hours ago

Double brackets are less portable. For example musl linux does not come with bash by default, and your script fails.

When unsure, use shellcheck.

duskdozer 6 hours ago | parent | next [-]

You mean shellcheck will detect when single brackets won't be enough? I've also just defaulted to double because I never really looked into it

stabbles 4 hours ago | parent [-]

Yeah, if you set the shebang `#!/bin/sh` (which is portable), shellcheck will complain about double brackets. It also helps you do quoting correctly when using single brackets.

a3w 6 hours ago | parent | prev [-]

[[ is built in, so "test[" as an /usr/bin artifact never exists? (What to call that proposed program, test2, or test[ ?)