You would also need to add a check -n "$NEWIP"
On Feb 18, 2012 9:36 AM, "Rogan Creswick" <[email protected]> wrote:

> <disclaimer> I only know enough about bash to know I shouldn't use it
> for anything important.  Others can explain what's going on in greater
> detail, I'm sure, but this should get you going.</disclaimer>
>
> On Sat, Feb 18, 2012 at 9:01 AM, Rich Shepard <[email protected]>
> wrote:
> >
> >   OK. CURRENTIP does exist. Even if curl could not connect to the URL why
> > generate an error message about expecting a unary operator for the !=?
>
> Because, unfortunately, when curl returns nothing (as it dose on error
> with -s) then $NEWIP is also set to nothing, which (due to the way
> bash behaves -- badly, IMHO) causes that left hand argument to *go
> away*.  eg:
>
> if [ $NEWIP != $OLDIP ];
>
> turns into somthing like:
>
> if [  != $OLDIP ];
>
> Quoting $NEWIP in the conditional will probably fix this.  eg:
>
> if [ "$NEWIP" != "$OLDIP" ];
>
> so you at least end up with:
>
> if [ "" != "$OLDIP" ];
>
> which still makes some sense.
>
> --Rogan
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to