🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #91

Re: [ vs. [[ in ksh

#91
From: Chet Ramey
Date: Tue, 21 Jul 1992 11:49
20 lines
1386 bytes
In article <Brp7Lr.AI5@root.co.uk> gwc@root.co.uk (Geoff Clare) writes:

>The work-around for this one is [ X"$X" = X"$Y" ], which is pretty robust.
>However, there are some things that are even harder to protect against,
>and you begin to wonder whether it's worth it.  Consider [ -f "$FILE" ],
>a very common usage, and what happens when FILE contains `='.

The Posix.2 specification of test contains a much more robust algorithm
based on the number of arguments to the test command that avoids many
of the traditional problems.

Bash implements this algorithm; so does the standalone GNU shellutils
`test'.

Chet
-- 
``The use of history as therapy means the corruption of history as history.''
	-- Arthur Schlesinger

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu
Technical Details
Message-ID: <1992Jul21.114928.12787@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!odin!chet
References: <1992Jul16.055054.20973@ddsw1.mcs.com> <1992Jul16.180423.7628@u.washington.edu> <Brp7Lr.AI5@root.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!odin!chet
From: chet@odin.INS.CWRU.Edu (Chet Ramey)
Subject: Re: [ vs. [[ in ksh
Message-ID: <1992Jul21.114928.12787@usenet.ins.cwru.edu>
Sender: news@usenet.ins.cwru.edu
Nntp-Posting-Host: odin.ins.cwru.edu
Organization: Case Western Reserve University, Cleveland, OH (USA)
References: <1992Jul16.055054.20973@ddsw1.mcs.com> <1992Jul16.180423.7628@u.washington.edu> <Brp7Lr.AI5@root.co.uk>
Date: Tue, 21 Jul 92 11:49:28 GMT
Lines:       21