On Sat, Dec 1, 2018 at 9:48 PM Thorsten Glaser <t.gla...@tarent.de> wrote: > > On Sat, 1 Dec 2018, Dmitry Bogatov wrote: > > > AFAIK, in shell [ "${foo}" ] is equal to [ -n "${foo}" ]. > > Not always / portably. > > > I recommend > > test -n "$foo" > > for POSIX (which is equivalent to [ -n "$foo" ] but better legible and > making it clear that test is an external command, not a language con‐ > struct), and > > [[ $foo ]] > > for Korn shell and compatibles, including (here) GNU bash. > > bye, > //mirabilos (mksh developer) > -- > 15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
Thank you Dmitry and Thorsten reviews and suggestions. This needs to run under both dash and bash, also other lines in the file are using [ so it'd be better not using a different style than the rest.