Case modification? #846
Replies: 3 comments 12 replies
-
|
Where does the ksh manual page claim that? I don't see it. Could you quote the relevant text? |
Beta Was this translation helpful? Give feedback.
-
|
The new case modification expansions feature is now on the dev branch. See c1762e0. There are no regression tests yet. It should be compatible with bash, but also more powerful because the pattern part of the expansion can match any number of characters in the value, whereas in bash, it is only allowed to match one character. Please test it and let me know how it goes :) |
Beta Was this translation helpful? Give feedback.
-
|
@McDutchie Yep. I messed up the Similarily for what you are investigating with using the ${var##} (remove left pattern), I presently like viewing the case modification $ ksh -c 'val="Arrr thar be PIRATES!"; typeset -a arr=($val); echo ${arr[@]/[A-Oa-o]/#}'
#rrr t#ar #e P#RATES!
$ ksh -c 'val="Arrr thar be PIRATES!"; typeset -a arr=($val); echo ${arr[@],[A-Oa-o]}'
arrr thar be PIRATES!
$ ksh -c 'val="Arrr thar be PIRATES!"; typeset -a arr=($val); echo ${arr[@]//[A-Oa-o]/#}'
#rrr t##r ## P#R#T#S!
$ ksh -c 'val="Arrr thar be PIRATES!"; typeset -a arr=($val); echo ${arr[@],,[A-Oa-o]}'
arrr thar be PiRaTeS! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the ksh manual page, it claims to support case modification during parameter expansion, most notable with ${parm^^} and ${parm,,}, plus additional single letter changes and so on. Anyway, ksh, even the most recent version here, doesn't do any of it. From my point of view, even implementing only ${parm^^} and ${parm,,} would be a great first step. At least this matter should be on a to-do list somewhere, since it's been in the manual page quite a while.
Beta Was this translation helpful? Give feedback.
All reactions