[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Behavior of ${var/*/text} has changed
From: |
Eric Pruitt |
Subject: |
Re: Behavior of ${var/*/text} has changed |
Date: |
Fri, 16 Sep 2016 12:38:20 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, Sep 16, 2016 at 12:30:59PM -0700, Eric Pruitt wrote:
> > That, or ${VAR:+not empty} which is how I suggest testing for variable
> > set-and-not-empty-ness.
>
> I'm aware of that construct, but that doesn't do what I want unless I'm
> missing something; I don't want to change the value of the variable.
Actually, I misunderstood what you wrote when I skimmed your message the
first time. However, that construct still won't work because if a
variable is defined, it will still choose "not empty:"
ericpruitt@sinister:~$ X=
ericpruitt@sinister:~$ echo ${X+Not empty}
Not empty
ericpruitt@sinister:~$ X=XXX
ericpruitt@sinister:~$ echo ${X+Not empty}
Not empty
Eric
Re: Behavior of ${var/*/text} has changed, Chet Ramey, 2016/09/17