我正在学习bash manual
。
在页面27/166
,我真的无法理解最后一个参数扩展:
${parameter^pattern}
${parameter^^pattern}
${parameter,pattern}
${parameter,,pattern}
有人可以告诉我这些扩展意味着什么吗?
一些例子也值得赞赏。
答案 0 :(得分:1)
小写
$ string="A FEW WORDS"
$ echo ${string,}
a FEW WORDS
$ echo ${string,,}
a few words
大写
$ string="a few words"
$ echo ${string^}
A few words
$ echo ${string^^}
A FEW WORDS