blob: 52dd4a15ea603b23e6bef7cba5b92bbba5cd0fd3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# expansions involving patterns
var='[hello'
echo "${var//[/}"
red='\[\e[0;31m\]'
printf "%s\n" "${red//\\[\\e/}"
foo="${red//\\[\\e/}"
# foo == [0;31m\]
printf "%s\n" "${foo//[0;31m\\/}"
echo "${var//[]/}"
echo "${red//[]/}"
v=hello
foo='[:alpha:]'
echo ${v//[[:alpha:]]/}
echo ${v//[[:alpha]]/}
echo ${v//[[:alpha]/}
|