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
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 ju
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" >> /path/
> -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
>
> Mich
Michael Sierchio 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
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.
--
-
> -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: Bou
On Mon, Jun 10, 2013 at 12:16 PM, Tim Daneliuk 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 sh is bas
> -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 shel
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 &qu
> -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 Mon, 10 Jun 2013 14:05:45 -0500, Tim Daneliuk
wrote:
if [ _"$PTR" == _ ] ; then
I've never seen this syntax before. Intriguing!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
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 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.: unexpecte
> -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: Bou
> -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:
>
16 matches
Mail list logo