标签:时间 shell脚本基础 lang 技术 RoCE com %s exit type
执行1.sh脚本赋予权限
date #输出时间的
cal #输出日历的
cal -y #输出一年的日历
echo $LANG
LANG=en #把语言改成
date +%Y
date +%Y
date +%m
date +%M
date +%d
date +%D
date
date +%h
date +%H
date +%s
date +%S
date +%t
date +%T
date +%H-%M-%S
date +%f
date +%F
date +%w
date +%W
```![](http://i2.51cto.com/images/blog/201809/26/b57b16cf4eb4e1311fbf5e6403470f30.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
计算器:`安装yum install bc`![](http://i2.51cto.com/images/blog/201809/26/7182e67d552d49c0a24e8ffa25e40f04.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
编辑脚本2.sh![](http://i2.51cto.com/images/blog/201809/26/c437cffc2cbe6041ebfc90f9a0cd6826.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
给2.sh赋予权限执行查看![](http://i2.51cto.com/images/blog/201809/26/024fc74f8a08e2cc92eca74887e40640.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
配置3.sh脚本文件![](http://i2.51cto.com/images/blog/201809/26/8753f5e279423895f77f39193e1d7f9f.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
赋予权限 运行3.sh脚本查看运行过程![](http://i2.51cto.com/images/blog/201809/26/8cd9ea93164448ba40d6f70648334750.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
配置4.sh脚本文件![](http://i2.51cto.com/images/blog/201809/26/26e253f90f2f6e6c4fc3936647bfbaf6.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
赋予权限 运行4.sh脚本查看运行过程![](http://i2.51cto.com/images/blog/201809/26/51aa3cdb7c48066729da9277acb4782a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
编辑脚本5![](http://i2.51cto.com/images/blog/201809/26/20fb157a9275eda31d90dbeb1d72ab16.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
“或”命令
#[-e /dev/cdrom] && echo "Exit"
Exit
#[$USER = root] || echo"user"
#su -yyy
#$ [$USER = root] || echo "yyy"
yyy
“非”命令
#[1!=1] || echo "root"
root
标签:时间 shell脚本基础 lang 技术 RoCE com %s exit type
原文地址:http://blog.51cto.com/13956204/2286224