加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell脚本基础

发布时间:2020-12-15 23:25:50 所属栏目:安全 来源:网络整理
导读:执行1.sh脚本赋予权限 时间查看命令: date #输出时间的 cal #输出日历的cal -y #输出一年的日历echo $LANGLANG=en #把语言改成date +%Ydate +%Ydate +%mdate +%Mdate +%ddate +%Ddatedate +%hdate +%Hdate +%sdate +%Sdate +%tdate +%Tdate +%H-%M-%Sdate +
执行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,type_ZmFuZ3poZW5naGVpdGk=)
编辑脚本2.sh![](http://i2.51cto.com/images/blog/201809/26/c437cffc2cbe6041ebfc90f9a0cd6826.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
给2.sh赋予权限执行查看![](http://i2.51cto.com/images/blog/201809/26/024fc74f8a08e2cc92eca74887e40640.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
配置3.sh脚本文件![](http://i2.51cto.com/images/blog/201809/26/8753f5e279423895f77f39193e1d7f9f.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
赋予权限 运行3.sh脚本查看运行过程![](http://i2.51cto.com/images/blog/201809/26/8cd9ea93164448ba40d6f70648334750.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
配置4.sh脚本文件![](http://i2.51cto.com/images/blog/201809/26/26e253f90f2f6e6c4fc3936647bfbaf6.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
赋予权限 运行4.sh脚本查看运行过程![](http://i2.51cto.com/images/blog/201809/26/51aa3cdb7c48066729da9277acb4782a.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)
编辑脚本5![](http://i2.51cto.com/images/blog/201809/26/20fb157a9275eda31d90dbeb1d72ab16.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk=)

“或”命令
#[-e /dev/cdrom] && echo "Exit"
Exit
#[$USER = root] || echo"user"
#su -yyy
#$ [$USER = root] || echo "yyy"
yyy

“非”命令
#[1!=1] || echo "root"
root

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读