4 ms·
> you should avoid using [[, preferring to use [ I tend to agree, and have taken this one step further, preferring the "test" command: if test "$a" = "foo"
by cellularmitosis 4y ago
> you should avoid using [[, preferring to use [
I tend to agree, and have taken this one step further, preferring the "test" command:
if test "$a" = "foo" ; then
I do this for a few reasons:
- "Subsetting" your language can be beneficial: https://wiki.c2.com/?LanguageSubset https://wiki.c2.com/?LanguageSubset
- "test" reinforces the notion that this is just the name of a program, not a syntax construct, which encourages using other programs as predicates, e.g. 'if which -s foo'.
- "man test" doesn't force you to wade through a 5,000 line man page.
Recent example: https://leopard.sh/leopard.sh https://leopard.sh/leopard.sh
- lanstin 4y agoWow haven’t seen a c2 link not from me in so long. So much good and interesting thought there.