On 10.06.2013 20:53, lcon...@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
On 06/10/2013 21:10, dte...@freebsd.org wrote:
Character sentinels are not required.
FreeBSD's sh(1) knows (because [ is a built-in) that when you quote a
parameter, that it is not (even if the value begins with -) not an operator.
What you are saying here is at least misleading. I just
On Jun 11, 2013, at 2:56 AM, Jan Henrik Sylvester wrote:
On 06/10/2013 21:10, dte...@freebsd.org wrote:
Character sentinels are not required.
FreeBSD's sh(1) knows (because [ is a built-in) that when you quote a
parameter, that it is not (even if the value begins with -) not an
operator.
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
thanks
Len
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of lcon...@go2france.com
Sent: Monday, June 10, 2013 11:53 AM
To: freebsd-questions@freebsd.org
Subject: Bourne shell if syntax
script fragment:
PTR=`dig
-Original Message-
From: Devin Teske [mailto:devin.te...@fisglobal.com] On Behalf Of
dte...@freebsd.org
Sent: Monday, June 10, 2013 11:59 AM
To: lcon...@go2france.com; freebsd-questions@freebsd.org
Cc: Devin Teske
Subject: RE: Bourne shell if syntax
-Original Message
On 06/10/2013 01:53 PM, lcon...@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
On 06/10/2013 01:59 PM, dte...@freebsd.org wrote:
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of lcon...@go2france.com
Sent: Monday, June 10, 2013 11:53 AM
To: freebsd-questions@freebsd.org
Subject: Bourne shell
On Mon, 10 Jun 2013 14:05:45 -0500, Tim Daneliuk tun...@tundraware.com
wrote:
if [ _$PTR == _ ] ; then
I've never seen this syntax before. Intriguing!
___
freebsd-questions@freebsd.org mailing list
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Tim Daneliuk
Sent: Monday, June 10, 2013 12:06 PM
To: freebsd-questions@freebsd.org
Subject: Re: Bourne shell if syntax
On 06/10/2013 01:59 PM, dte
On 06/10/2013 02:10 PM, dte...@freebsd.org wrote:
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Tim Daneliuk
Sent: Monday, June 10, 2013 12:06 PM
To: freebsd-questions@freebsd.org
Subject: Re: Bourne shell
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Tim Daneliuk
Sent: Monday, June 10, 2013 12:17 PM
To: dte...@freebsd.org
Cc: freebsd-questions@freebsd.org
Subject: Re: Bourne shell if syntax
On 06/10/2013
On Mon, Jun 10, 2013 at 12:16 PM, Tim Daneliuk tun...@tundraware.com wrote:
That wasn't really my point. I use sentinels because in the face of an
empty string this:
if [ $PTR = ]
Actually evaluates to:
if [ = ]
Which throws an error.
Right. Many scripts seem to assume that
-Original Message-
From: Devin Teske [mailto:devin.te...@fisglobal.com] On Behalf Of
dte...@freebsd.org
Sent: Monday, June 10, 2013 12:19 PM
To: tun...@tundraware.com; freebsd-questions@freebsd.org
Cc: dte...@freebsd.org
Subject: RE: Bourne shell if syntax
-Original
On 06/10/2013 02:21 PM, dte...@freebsd.org wrote:
ctually, there's another reason you should also avoid the above (unquoted
parameter), and that's in the case of a multi-word value. For example:
Yup, that's the compelling case for using quoting.
--
Michael Sierchio kudzu at tenebras.com writes:
...
Right. Many scripts seem to assume that sh is bash, and that's
certainly not the case here.
if [ x$BLAH = x ]; then
is the most reliable and portable way of determining if it's a string
of zero length.
Actually this trick is not
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of jb
Sent: Monday, June 10, 2013 12:53 PM
To: freebsd-questions@freebsd.org
Subject: Re: Bourne shell if syntax
Michael Sierchio kudzu at tenebras.com writes
17 matches
Mail list logo