简体   繁体   English

Shell参数扩展需要说明

[英]Shell Parameter Expansion need the explanation

I'm learning bash manual . 我正在学习bash manual

At page 27/166 , I really can't understand the last Parameter Expansion: 在第27/166页,我真的不明白最后一个参数扩展:

${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 在Bash Shell脚本中将字符串转换为小写

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM