linux、shell一些操作指令

1、cd $(dirname $0)   shell脚本里面添加这个命令就可以进入此sh目录下,不用写绝对路径

2、strMac=`ifconfig eth0 | grep "HWaddr" | awk '{print $5}'`   获取mac地址

3、strMacParse=${strMac//:/}   去掉字符串中的冒号:

4、ln -sfn XXX YYY   把XXX的软链接设置成YYY

5、截取双引号中的值,declare -x QT_IM_MODULE="fcitx",我要获取fctix,可以使用`echo $env | awk -F'"' '{print $2}'`

posted @ 2019-01-29 11:14  徐沛东  阅读(370)  评论(0编辑  收藏  举报