문제

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

Converting string to lower case in Bash shell scripting

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top