在Shell中过滤、判断字母方法:
方法一、
[root@SHELL-X64 scripts]# abc=1ab8ddd90
[root@SHELL-X64 scripts]# echo ${abc//[0-9]}
abddd
方法二、
[root@SHELL-X64 scripts]# echo $abc | sed 's#[0-9]##g'
abddd
方法三、
[root@SHELL-X64 scripts]# abc=123
[root@SHELL-X64 scripts]# expr 1 + $abc
124
[root@SHELL-X64 scripts]# echo $?
0
[root@SHELL-X64 scripts]# abc=23dd
[root@SHELL-X64 scripts]# expr 1 + $abc
expr: non-numeric argument
[root@SHELL-X64 scripts]# echo $?
2