[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] ${var:?message} customization

From: Dan Douglas
Subject: Re: [Help-bash] ${var:?message} customization
Date: Thu, 14 May 2015 17:38:27 -0500

On Thu, May 14, 2015 at 7:23 AM, Greg Wooledge <address@hidden> wrote:
> (That's all using POSIX sh syntax.  Recent versions of bash have a
> "test -v" command, but I don't think it adds much utility.)

test -v comes from ksh. I used to think it was necessary because
testing whether an element of an array or compound variable is set
isn't as simple as testing whether the zeroth element is set as in
bash, because an array or compound var may contain an array or other
type whose "setness" is independent of its container. However I don't
know offhand of a case where it differs from ${var+word}. You have to
admit it's generally easier to understand when there's a dedicated way
to test.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]