summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-vars/var_bash2.tests
blob: 29c526cefdd12d2c83a839ba2c22ae5fa7f1df12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var=abc123dcba123

echo ${var/d/x}
echo ${var/c/x}
echo ${var//c/x}
echo ${var/[123]/x}
echo ${var//[123]/x}
echo ${var/c*/x}
echo ${var/*c/x}

# must match longest match: result is "abx23"
echo ${var/c*1/x}

# empty replacement - 2nd slash can be omitted
echo ${var/[123]}
echo ${var//[123]}

### ash doesn't support
### # match only at the beginning:
### echo ${var/#a/x}
### echo ${var/#b/x} # should not match
### echo ${var//#b/x} # should not match
### # match only at the end:
### echo ${var/%3/x}