shel命令/l脚本
kkfgh
这个作者很懒,什么都没留下…
展开
-
shell脚本输出颜色字体
echo -e "\033[31m 红色字 \033[0m"echo -e "\033[33m 黄色字 \033[0m"echo -e "\033[41;33m 红底黄字 \033[0m"echo -e "\033[41;37m 红底白字 \033[0m"原创 2016-07-18 11:11:51 · 429 阅读 · 0 评论 -
修改centos系统时间为重庆时间(当前时间)
最快捷有效的方法:替换Centos系统时区文件。cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime原创 2016-07-18 11:10:05 · 338 阅读 · 0 评论 -
通过IP查找ip所对应网卡名
ip route | grep 172.16.30.130 | awk -F '[ \t*]' '{print $3}'执行的结果:[root@localhost xml_onvif]# ip route | grep 172.16.30.130 | awk -F '[ \t*]' '{print $3}'eth1原创 2016-07-18 11:07:38 · 2985 阅读 · 0 评论 -
查看Linux目录和文件大小
1、查看 /opt 整个目录大小[root@localhost xml_onvif]# df -h /optFilesystem Size Used Avail Use% Mounted on/dev/sda2 18G 12G 5.3G 69% /2、查看 /opt 目录下的文件大小[root@localho原创 2016-07-18 11:05:16 · 5581 阅读 · 0 评论 -
shell输入密码隐藏回显
#!/bin/bash#输入密码不回显function enterPass(){ local PASSWORD="" stty -echo #设置输入不回显 read -p "Please input PASSWORD: " PASSWORD echo -e "\r" #换行 stty echo #取消不回显 echo "En原创 2016-07-18 11:02:31 · 1720 阅读 · 0 评论 -
shell 条件判断的几种方式!
#第一种:if ...then...fi function test1(){local RET=0if [ $RET -eq 0 ];thenecho "yes"elseecho "no"fi}#第二种: []function test2(){local RET=0[ $RET -eq 0 ] && echo "yes" || echo原创 2016-07-18 15:08:19 · 838 阅读 · 0 评论