📜  bash 大写错误替换 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:46.582000             🧑  作者: Mango

代码示例1
var=hello #For Bash Version higher than 4.3.33 try these
echo ${var''} #Uppercase whole string
HELLO
echo ${var'} #Uppercase only first char of string
Hello
var2=BYE
echo ${var2,} #Lowercase whole string
bye
echo ${var2,,} #Lowercase only first char of string
bYE
echo $var | tr 'a-z' 'A-Z' #For lower versions of Bash just use tr command
HELLO