[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD005AE2B@AcuExch.aculab.com>
Date: Fri, 18 Aug 2017 16:38:15 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Phil Sutter' <phil@....cc>
CC: Stephen Hemminger <stephen@...workplumber.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [iproute PATCH v2 2/2] ifcfg: Quote left-hand side of [ ]
expression
From: Phil Sutter
> Sent: 18 August 2017 12:24
...
> > > -if [ `ip link ls $dev | grep -c MULTICAST` -ge 1 ]; then
> > > +if [ "`ip link ls $dev | grep -c MULTICAST`" -ge 1 ]; then
> >
> > You could drag all these scripts into the 1990's by using $(...)
> > instead of `...`.
>
> That's a different kettle of fish IMO, using $() doesn't change the
> situation this addresses:
>
> | $ [ $(echo foo bar) -eq 0 ] && echo ok
> | bash: [: too many arguments
> | $ [ "$(echo foo bar)" -eq 0 ] && echo ok
> | bash: [: foo bar: integer expression expected
I didn't say it would.
IFS=
set -o noglob
would though - not that I'd suggest it here.
protecting the 'eval' is somewhat harder.
David
Powered by blists - more mailing lists