
shell
文章平均质量分 79
还能中文
这个作者很懒,什么都没留下…
展开
-
shell脚本的基本命令
diff 用来比较两个文件或目录的不同 diff [options] [target1] [target2] /mnt新建文件file1 file2比较不同: [root@desktop110 mnt]# diff file1 file2 1,2c1 ###表示第一个文件file1的第1行和第2行change下边的两行内容就和file2文件相同 &...原创 2018-03-06 20:16:37 · 1103 阅读 · 0 评论 -
python初识
python的简史 • 1989年,Guido(龟叔)python。 • 1990年, 发布python的第一个版本; • 2001年发布python2.0版本; • 2010年获年度Tiobe编程语言大奖 • 2013年发布python3.x版本; python优点 •简单、优雅、明确 •有强大的第三方库模块 •可跨平台移植 •一种面向对象的语言 python缺点 ...原创 2018-03-14 19:55:05 · 292 阅读 · 0 评论 -
for语句--shell
for语句for ... in .... do done示例:#!/bin/bash for NUM in {1..5} do echo $NUM done执行脚本结果如下[root@server210 mnt]# sh for.sh 1 2 3 4 5 再比如#!/bin/bash for CHAR in rehat westos linux do echo $CHAR d原创 2018-03-09 18:50:25 · 156 阅读 · 0 评论 -
while语句--shell
while 条件 do done 实验:当脚本后第一串字符为happy时输出this is happy day;事实上,输入happy时while条件永远都会满足,就是说这时无限循环的 #!/bin/bash while [ "$1" = "happy" ] do echo this\'s $1 day done 执行结果this is happy day ......原创 2018-03-09 19:20:37 · 299 阅读 · 0 评论 -
if语句-shell
最基本形式 if 条件1 then 动作1 else 动作2 fi镶嵌结构if 条件1 then elif 条件2 then 动作2 ... else 动作3 fi实验1: 9 #!/bin/bash 10 if 11 [ "$1" = "c" ] 12 then 13 read -p "input原创 2018-03-09 20:05:52 · 148 阅读 · 0 评论 -
case语句--shell
case $1 in word1 ) action1 ;; word2) action2 ;; ........ *) action_last esac实验1:服务的查看9 #!/bin/bash 10 case $1 in 11 status) 12 systemctl $1 $2 1原创 2018-03-09 20:23:40 · 328 阅读 · 0 评论 -
expect语句--shell
expect expect 是自动应答命令用于交互式命令的自动执行 spawn 是 expect 中的监控程序,其运行后会监控命令提出的交互问题 send发送问题答案给交互命令 “\r”表示回车 exp_continue 标示当问题不存在时继续回答下面的问题 expect eof 标示问题回答完毕退出 expect 环境 interact标示问题回答完毕留在交互界面 set NAM...原创 2018-03-09 21:12:10 · 890 阅读 · 0 评论