Home » Linux » What does 2 commas after variable name mean in bash?

What does 2 commas after variable name mean in bash?

Posted by: admin January 30, 2018 Leave a comment

Questions:

Recently I came across this syntax:

${reportName,,}

I could not find anything by googling, so does anyone know what does those ,, mean?

Answers:

This is called “Parameter Expansion” available in bash version 4+ . To change the case of the string stored in the variable to lower case.Eg:

var=HeyThere
echo ${var,,}
heythere

You may want to try some additional commands and check the effect : source

${var^}
${var^^}
${var,}
${var,,}

Note: “Parameter Expansion” is present in man bash .Search for it.