Last change
on this file since 3388 was 3320, checked in by Bruno Cornec, 10 years ago |
- Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in
the move to 3.0
|
-
Property svn:executable
set to
*
|
File size:
505 bytes
|
Rev | Line | |
---|
[3320] | 1 | var=abc123dcba123
|
---|
| 2 |
|
---|
| 3 | echo ${var/d/x}
|
---|
| 4 | echo ${var/c/x}
|
---|
| 5 | echo ${var//c/x}
|
---|
| 6 | echo ${var/[123]/x}
|
---|
| 7 | echo ${var//[123]/x}
|
---|
| 8 | echo ${var/c*/x}
|
---|
| 9 | echo ${var/*c/x}
|
---|
| 10 |
|
---|
| 11 | # must match longest match: result is "abx23"
|
---|
| 12 | echo ${var/c*1/x}
|
---|
| 13 |
|
---|
| 14 | # empty replacement - 2nd slash can be omitted
|
---|
| 15 | echo ${var/[123]}
|
---|
| 16 | echo ${var//[123]}
|
---|
| 17 |
|
---|
| 18 | ### ash doesn't support
|
---|
| 19 | ### # match only at the beginning:
|
---|
| 20 | ### echo ${var/#a/x}
|
---|
| 21 | ### echo ${var/#b/x} # should not match
|
---|
| 22 | ### echo ${var//#b/x} # should not match
|
---|
| 23 | ### # match only at the end:
|
---|
| 24 | ### echo ${var/%3/x}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.