标签:style color ar strong sp on bs new as
1. 字符串如何大小写转换
str="This is a Bash Shell script."
1> tr方式
newstr=`tr ‘[A-Z]‘ ‘[a-z]‘ <<<"$str"`或者 newstr=$(echo $str |tr ‘[a-z]‘ ‘[A-Z]‘)
2> typeset
typeset -u VARIABLE (把VARIABLE的小写转换成大写)
typeset -l VARIABLE (把VARIABLE的大写转换成小写)
如:
[oracle@node3 ~]$ typeset -u str
[oracle@node3 ~]$ str="This is a Bash Shell script."
[oracle@node3 ~]$ echo $str
THIS IS A BASH SHELL SCRIPT.
标签:style color ar strong sp on bs new as
原文地址:http://www.cnblogs.com/ivictor/p/4025760.html