Bourne shell "if" syntax

Christoph Kukulies kuku at kukulies.org
Tue Jun 11 07:17:36 UTC 2013


On 10.06.2013 20:53, lconrad at go2france.com wrote:
>
>
> script fragment:
>
> PTR=`dig @some.dns +short +norec -x a.b.c.d`
>
> echo "$PTR"
>
> if  [  "$PTR"  ==  ""  ]  ;  then


Use something like (== is wrong, btw.)

#!/bin/sh

if [ "X$1" = "X" ] ; then
    echo foo
fi


--
Christoph

>
> 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
>
> thanks
> Len
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list