Pattern substitution insensitive to case?
Hi, Bash doesn't seem to provide a handy way to perform search-and-replace on strings in a case-insensitive manner. The parameter expansion "${parameter/pattern/string}" is not influenced by the shell options "nocaseglob" and "nocasematch", at least in Bash version 4.2.37. Is this intended? My temporary workaround is to run the search-replace function on GNU 'sed' with the unportable 'I' flag to ignore case. -- Davide
Re: Pattern substitution insensitive to case?
On 9/11/13 5:12 AM, Davide Baldini wrote: > Hi, > > Bash doesn't seem to provide a handy way to perform search-and-replace on > strings in a case-insensitive manner. > > The parameter expansion "${parameter/pattern/string}" is not influenced by > the shell options "nocaseglob" and "nocasematch", at least in Bash version > 4.2.37. Is this intended? Yes, neither option applies to pattern replacement word expansion. I will consider that extension for a future version of bash. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Can't declare associative global arrays inside function
On 9/10/13 12:36 PM, Carlos Pita wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i686 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' > -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib > -D_FORTIFY_SOURCE=2 -march=i686 -mtune=generic -O2 -pipe > -fstack-protector --param=ssp-buffer-size=4 > -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' > -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' > -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' > uname output: Linux netbook 3.10.3-1-ARCH #1 SMP PREEMPT Fri Jul 26 > 17:13:15 CEST 2013 i686 GNU/Linux > Machine Type: i686-pc-linux-gnu > > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > It's not possible to declare an array that is both global and > associative using declare > inside a function. Thanks for the report. This has been fixed for the next bash release, and the fix is already in the bash devel git tree. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/