In a script I found, I see this construction:
is_true() {
local var=${1,,}
...
As I understand it is some kind of parameter passing. $1,$2,$# I understand but what ${1,,} stands for?
This ( ${1,,}
) is called "Parameter Expansion" available in bash version 4+ . Here it is used to change the case of the string stored in the variable, In this case first argument to the script.
Some examples: Lower case conversion.
x='HellO'
echo ${x}
HellO
echo ${x,,}
hello
To convert $x
into upper case.
echo ${x^^}
HELLO
To invert the case:
x='Hey there'
echo ${x~~}
hEY THERE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With