diff options
author | André Aparício <aparicio99@gmail.com> | 2012-07-21 02:52:35 +0100 |
---|---|---|
committer | Petteri Räty <petsku@petteriraty.eu> | 2012-08-19 17:52:07 +0300 |
commit | b2f509d72462bbf3dcd89d0164e435556980e3ba (patch) | |
tree | d1c06a11be6b391cada86c2251ab26d3cdfc4d5d /scripts | |
parent | Merge remote-tracking branch 'aparicio/multiline_string_declaration' (diff) | |
download | libbash-b2f509d72462bbf3dcd89d0164e435556980e3ba.tar.gz libbash-b2f509d72462bbf3dcd89d0164e435556980e3ba.tar.bz2 libbash-b2f509d72462bbf3dcd89d0164e435556980e3ba.zip |
Walker: Support string operations on arrays
When a variable expansion applies some string operation like replace on
the whole array, apply the operation to every element in the array.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/var_expansion.bash | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/var_expansion.bash b/scripts/var_expansion.bash index 97e9587..9ba4286 100644 --- a/scripts/var_expansion.bash +++ b/scripts/var_expansion.bash @@ -79,6 +79,17 @@ echo ${FOO039/*(l)} echo ${FOO039/?(l)} echo ${FOO039/@([a-c]|[k-m])} echo ${FOO039//@([a-c]|[k-m])} +FOO40=("foo bar" foo bar foobar) +FOO40=("foo bar foo" bar foo foobar) +echo ${FOO40[@]/foo/poo} +echo ${FOO40[@]//foo/poo} +echo ${FOO40[@]#foo} +echo ${FOO40[@]##f*o} +echo ${FOO40[@]%foo} +echo ${FOO40[@]%%f*o} +echo ${FOO40[@]/#foo} +echo ${FOO40[@]/%foo} +echo ${FOO40[@]} target="abc123abc" echo "${target##+(ab[c])*([[:digit:]])}" function positional_parameter_test(){ |