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

On Mon, 20 Jul 2020 17:08:38 +0200
"A. Dumas"  wrote:

> 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,

 However that only works in bash so be sure to specify bash in the
shebang rather than /bin/sh which may be something more like a real Bourne
shell and not support extensions like [[.

> and within which Bash does not
> split words. Also allows ==,&&,etc. which are probably clearer to
> programmers not living in Bash. This prints yes:

 For shell scripts I prefer to restrict myself to Bourne shell
syntax for portability reasons.

> (but I would still use double quotes "$t" every time...)

 Yes.

--
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
The computer obeys and wins.                |    licences available see
You lose and Bill collects.                 |    http://www.sohara.org/

--- 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™.