I'm writing a pre-rebase hook for Git using bash script and I need to convert a string to lowerCase or UperCase. I tried some methods doumented in Bash reference
example:
myString="AbcDFmk"; echo ${myString,,}and this is the result: ${myString,}: bad substitution
Can you please help me to find a way to do this?
21 Answer
The Bash reference you mention is for Bash version 4.3. String substitutions are not supported in 3.1.
You can use tr like this:
echo $(tr '[:upper:]' '[:lower:]'<<<${myString})