]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/new-exp11.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / new-exp11.sub
CommitLineData
8868edaf
CR
1# This program is free software: you can redistribute it and/or modify
2# it under the terms of the GNU General Public License as published by
3# the Free Software Foundation, either version 3 of the License, or
4# (at your option) any later version.
5#
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU General Public License for more details.
10#
11# You should have received a copy of the GNU General Public License
12# along with this program. If not, see <http://www.gnu.org/licenses/>.
13#
d233b485
CR
14# pattern matching and replacement operators with multibyte characters
15
16LANG=en_US.UTF-8
17
18s1='abcådef'
19s2='Ã¥'
20s3='ḅć'
21
22s23=${s2}${s3}
23
24echo ${s1/$s2/xxx}
25echo ${s1/$s3/xxx}
26
27echo ${s23/#$s2/}
28echo ${s23/%$s3/}
29
30echo ${s23/#$s2/prepend}
31echo ${s23/%$s3/append}
32
33echo ${s2/#/prepend}
34echo ${s3/%/append}
35
36echo ${s2/#/}
37echo ${s3/%/}
38
39recho ${s2/$s2/}
40recho ${s3/$s3/}
41
42# posix pattern replacements
43
44echo ${s23##$s2}
45echo ${s23#$s2}
46
47echo ${s23%%$s3}
48echo ${s23%$s3}
49
50# fail
51
52echo ${s2/#ab/xx}
53echo ${s3/%ab/xx}
54
55echo ${s2#ab}
56echo ${s2##ab}
57
58echo ${s3%ab}
59echo ${s3%%ab}