:: Re: [DNG] Wifi device names: was sy…
Página Principal
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Para: dng
Assunto: Re: [DNG] Wifi device names: was systemd is haunting me
On Sun, 31 Jan 2016 15:30:01 +0100
Didier Kryn <kryn@???> wrote:

> Le 31/01/2016 03:12, Steve Litt a écrit :
> > #!/bin/sh
> > if test "$#" == "0"; then
> >    lineno="1"
> > else
> >    lineno=$1
> > fi


[snip]

>      Doesn't work out of the box.

>
>      If /usr/bin/test was invoqued you should write '-eq' instead of 
> '=='. 


IIRC -eq is for numbers only, not strings. I put doublequotes around
each side of the == to make sure it's a string comparison. I
consistently do that unless there's a reason I actually want numbers to
add and subtract from.

> But shell languages have non-standard built-ins. If /bin/sh
> points to dash, like in Debian, then the built-in test would accept
> '='. I guess '==' is a bashism (actually the adoption of a Cism by a
> shell language). Replacing '==' by '=' just works.


Confirmed! I replaced the == by =, and it worked perfectly.

SteveT

Steve Litt
January 2016 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28