Bourne shell "if" syntax

Tim Daneliuk tundra at tundraware.com
Mon Jun 10 19:03:16 UTC 2013


On 06/10/2013 01:53 PM, lconrad at go2france.com wrote:
>
>
> script fragment:
>
> PTR=`dig @some.dns +short +norec -x a.b.c.d`
>
> echo "$PTR"
>
> if  [  "$PTR"  ==  ""  ]  ;  then
>
> echo "$PTR" >> /path/to/PTR_absent.txt
>
> fi
>
> ===========
>
> output for an IP:
>
>
> a-b-c-d.domain.net.
> [: a-b-c-d.domain.net.: unexpected operator
>


Try this instead and see if this fixes it:

    if  [  _"$PTR"  ==  _  ]  ;  then



-----------------------------------------------------------------------
Tim Daneliuk


More information about the freebsd-questions mailing list