# awk 命令
str1="MATCH"
str2="match"
awk -vs1="$str1" -vs2="$str2" 'BEGIN {
if ( tolower(s1) == tolower(s2) ){
print "match"
}
}'
直接使用变量自身转换
var1=TesT
var2=tEst
echo ${var1,,} ${var2,,} #转换为小写
echo ${var1^^} ${var2^^} #转换为大写
# awk 命令
str1="MATCH"
str2="match"
awk -vs1="$str1" -vs2="$str2" 'BEGIN {
if ( tolower(s1) == tolower(s2) ){
print "match"
}
}'
直接使用变量自身转换
var1=TesT
var2=tEst
echo ${var1,,} ${var2,,} #转换为小写
echo ${var1^^} ${var2^^} #转换为大写