bug-bash
[Top][All Lists]
Advanced

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

case modification won't work with pattern


From: Jerry Wang
Subject: case modification won't work with pattern
Date: Thu, 10 Mar 2011 10:22:12 +0800
User-agent: Mutt/1.5.20 (2009-06-14)

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib
-g -O2 -Wall
uname output: Linux Xubuntu 2.6.31-22-generic #73-Ubuntu SMP Fri Feb 11
17:36:01 UTC 2011 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.0
Patch Level: 33
Release Status: release

Description:
        The case modification won't work with pattern.
        I have a simple script a.sh, please see below:

        #! /bin/bash
        var="abcabc"
        echo "var: ${var}"
        echo "replace the leading \"ab\" to uppercase: ${var^ab}" # expect to 
get "ABcabc" ?
        echo "replace all the \"ab\" to uppercase: ${var^^ab}"    # expect to 
get "ABcABc" ?

        echo "replace the first \"a\" to uppercase: ${var^a}"
        echo "replace all \"a\" to uppercase: ${var^^a}"

        Then the result is:

        mylogin@Xubuntu:~/shell$ ./a.sh
        var: abcabc
        replace the leading "ab" to uppercase: abcabc   --> incorrect
        replace all the "ab" to uppercase: abcabc           --> incorrect 
        replace the first "a" to uppercase: Abcabc              --> correct
        replace all "a" to uppercase: AbcAbc                    --> correct


Repeat-By:

-- 
Jerry Wang jerry.j.wang@alcatel-lucent.com 



reply via email to

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