代码如下: #!/bin/sh #edit by www.jb51.net # [:upper:] [ A - Z ] # [:lower:] [ a - z ] # [:digit:] [ 0 - 9 ] # [:alnum:] [ 0 - 9 a - z A-Z] # [:space:] 空格或t a b键 # [:alpha:] [ a - z A - Z ] # tr for f in * do echo $f | tr "[:upper:]" "[:lower:]" done #awk #把当前目录下的所有小写文件名都改为大写文件名。 ls | awk '{printf("mv %s %s/n", $0, toupper($0))|"sh"}' #把当前目录下的所有大写文件名都改为小写文件名。 ls | awk '{printf("mv %s %s/n", $0, tolower($0))|"sh"}' #sed file="test.txt" cat $file | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'