How to convert a string to lower case using bash 3.1 available in gitExtension

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?

2

1 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})

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like