Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 2 commas after variable name mean in bash?

Tags:

linux

bash

shell

Recently I came across this syntax:

${reportName,,} 

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

like image 956
user1308345 Avatar asked Dec 15 '16 14:12

user1308345


People also ask

What does || mean in bash?

Logical OR Operator ( || ) in Bash It is usually used with boolean values and returns a boolean value. It returns true if at least one of the operands is true. Returns false if all values are false.

What does ${} mean in shell script?

Here are all the ways in which variables are substituted in Shell: ${variable} This command substitutes the value of the variable. ${variable:-word} If a variable is null or if it is not set, word is substituted for variable.

What does comma do in bash?

It has no special meaning. The command redirects to a file called ,update . Show activity on this post. A comma can be used in brace expansion, but there are no braces in the example you show.

What does $# mean in bash script?

$# is the number of positional parameters passed to the script, shell, or shell function. This is because, while a shell function is running, the positional parameters are temporarily replaced with the arguments to the function. This lets functions accept and use their own positional parameters.


1 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.

like image 57
P.... Avatar answered Oct 02 '22 21:10

P....