choice of control operators in scripts

Goetz Bock bock at blacknet.de
Mon May 12 21:21:28 UTC 2008


On Mon, May 12 '08 at 22:51, Cristian Ionescu-Idbohrn wrote:
> > If you fell paranoid today ... add x"" ...
> >
> > [ x"$foo" = x"bar" ]
> 
> I have no experience of shells that are _so_ buggy.  Do you mean this:
> 
> [ x-n = xbar ]
> 

with foo=-n the shell would expand
    [ "$foo" = "bar" ] 
to
    [ -n = bar ]

what [ (aka test) will not be able to parse. With
    [ x"$foo" = x"bar" ]
the shell will generate
    [ x-n = xbar ]

what [ (aka test) can parse.

-- 
/"\ Goetz Bock at blacknet dot de  --  secure mobile Linux everNETting
\ /       (c) 2008 Creative Commons, Attribution-ShareAlike 2.0 de
 X   [ 1. Use descriptive subjects - 2. Edit a reply for brevity -  ]
/ \  [ 3. Reply to the list - 4. Read the archive *before* you post ]



More information about the busybox mailing list