TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: AHEM A RIVET`S SHOT
from: A. DUMAS
date: 2020-07-20 17:08:00
subject: Re: Strange construct in

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)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.