Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11820

Comparison problem with case modification expansion in bash-4.3

From Corentin Peuvrel <cpeuvrel@pom-monitoring.com>
Newsgroups gnu.bash.bug
Subject Comparison problem with case modification expansion in bash-4.3
Date 2015-11-03 15:03 +0100
Message-ID <mailman.1560.1446559468.7904.bug-bash@gnu.org> (permalink)
References <55DC9992.8070209@pom-monitoring.com>

Show all headers | View raw


Hi,

I think I found a bug in bash-4.3 (4.3.42 in fedora 21), that seems to exists for a long time (at least from 4.1.2 in Centos 6).

I found a fairly simple way to reproduce it : you have to initialize a variable to an empty string, and do a comparaison to it while doing the case modification expansion ${var,,}

This doesn't work :
# foo="" ; [[ bar == *"${foo,,}"* ]] && echo ok

While this works fine :
# foo="" ; [[ bar == *"${foo}"* ]] && echo ok
ok

If you unset the variable, it works as we want :
# unset foo ; [[ bar == *"${foo,,}"* ]] && echo ok
ok

If the variable is not empty, it also works normally :
# foo="A" ; [[ bar == *"${foo,,}"* ]] && echo ok
ok

I hope it's not already known, but I couldn't find anything on the net.

Thank you,

Corentin Peuvrel

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Comparison problem with case modification expansion in bash-4.3 Corentin Peuvrel <cpeuvrel@pom-monitoring.com> - 2015-11-03 15:03 +0100

csiph-web