On 20/07/2020 14:44, Ahem A Rivet's Shot wrote:
>> And yes, wrapping the environment variable into double quotes does seem
>> to do the trick.
>
> It is also standard best practice for shell programming and has
> been for decades.
Another solution, not decades old, is to use double brackets [[ which is
a keyword, not a built-in like [ or test, and within which Bash does not
split words. Also allows ==,&&,etc. which are probably clearer to
programmers not living in Bash. This prints yes:
t='a b'; if [[ $t == 'a b' ]]; then echo yes; else echo no; fi
(but I would still use double quotes "$t" every time...)
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|