To lowercase
$ string="A FEW WORDS"
$ echo ${string,}
a FEW WORDS
$ echo ${string,,}
a few words
To uppercase
$ string="a few words"
$ echo ${string^}
A few words
$ echo ${string^^}
A FEW WORDS
Вопрос
I'm learning bash manual
.
At page 27/166
, I really can't understand the last Parameter Expansion:
${parameter^pattern}
${parameter^^pattern}
${parameter,pattern}
${parameter,,pattern}
Can someone please tell me what these expansions mean?
Some examples would also be appreciated.
Решение
To lowercase
$ string="A FEW WORDS"
$ echo ${string,}
a FEW WORDS
$ echo ${string,,}
a few words
To uppercase
$ string="a few words"
$ echo ${string^}
A few words
$ echo ${string^^}
A FEW WORDS