Multibyte character string after $1-9 in ksh is not expanded correctly
Issue
- When there is multibyte string after positional parameter variable $1-9 in ksh, the expansion result is incorrect.
< tested with the following ksh shell script >
$ cat test.sh
#!/bin/ksh
echo "$1テスト"
echo "${1}テスト"
echo "$1test"
$ cat test2.sh
#!/bin/ksh
echo "$1テスト" | od -x
echo "${1}テスト" | od -x
echo "$1test" | od -x
< ksh-20100621-19.el6_4.4.x86_64 - issue does NOT occur >
-----------
[root@localhost ~]# rpm -q ksh
ksh-20100621-19.el6_4.4.x86_64
[root@localhost ~]# ./test.sh
テスト
テスト
test
[root@localhost ~]# ./test2.sh
0000000 83e3 e386 b982 83e3 0a88
0000012
0000000 83e3 e386 b982 83e3 0a88
0000012
0000000 6574 7473 000a
0000005
-----------
< ksh-20120801-28.el6.1.x86_64 - issue does occur >
-----------
$ rpm -q ksh
ksh-20120801-28.el6.1.x86_64
$ ./test.sh
�スト <------ HERE
テスト
test
$ ./test2.sh
0000000 e386 b982 83e3 0a88 <------ HERE
0000010
0000000 83e3 e386 b982 83e3 0a88
0000012
0000000 6574 7473 000a
0000005
-----------
Environment
- Red Hat Enterprise Linux 6
- ksh-20120801
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.