On 6/23/25 5:02 AM, Takaaki Konno wrote:

Bash Version: 5.1
Patch Level: 4
Release Status: release

Description:

Parameters expanded to null by pattern removal or pattern substitution in the
patterns of case clauses produced unexpected results in some cases.

The version of bash in my system is 5.1, but the same results are produced in
bash 5.2.37 I built from source.

Repeat-By:

In the following example, I expected no output, but in fact it output "not
matched".

     x=abc
     case def in
         "${x#abc}"def) ;;
         "${x##abc}"def) ;;
         "${x%abc}"def) ;;
         "${x%%abc}"def) ;;
         "${x/abc/}"def) ;;
         "${x//abc/}"def) ;;
         "${x/#abc/}"def) ;;
         "${x/%abc/}"def) ;;
         *) echo 'not matched'
     esac
     # => not matched

Thanks for the report. I'll fix this after bash-5.3 is released.

Chet

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to