[Top][All Lists]

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

Re: Behavior of ${var/*/text} has changed

From: Chet Ramey
Subject: Re: Behavior of ${var/*/text} has changed
Date: Sat, 17 Sep 2016 13:02:43 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 9/16/16 3:06 PM, Eric Pruitt wrote:

> Bash Version: 4.4
> Patch Level: 0
> Release Status: release
> Description:
>       In Bash 4.3, "${var/*/text}" would generate "" if var was a zero-length
>       string and "text" if it contained at least one character. In Bash 4.4, 
> this
>       is no longer the case. I'm not sure if this is necessarily a bug, but I 
> was
>       unable to find this change in behavior in the change log or man page.

This was a bug in bash-4.3.  * will match 0 or more characters, so if $var
is null or unset, * should match it.  This entry in the CHANGES file
covers it:

llll. Fixed a bug that would not replace empty strings using pattern
      substitution even if the pattern matched the empty string.

According to the change log, it looks like I made this change back in May,

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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