shell中函数及循环使用

  • shell中echo的使用

shell中函数及循环使用shell中函数及循环使用shell中函数及循环使用shell中函数及循环使用

  • 编写脚本实现不自动退出,只有在输入exit时才退出--循环函数的使用

shell中函数及循环使用

shell中函数及循环使用

  • 编写一个脚本实现,当用户输入正确的用户时提示操作,输入不正确的操作时提示输入正确的用户,输入exit时退出

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

  • 编写一个脚本监控/目录下分区的大小,并把报警在当前显示出来

shell中函数及循环使用

shell中函数及循环使用

&意思为把Action这个脚本打入后台执行,当/下的空间大于40时系统会自动报警检测,可以添加时间重新执行脚本,会增加带时间的报警

shell中函数及循环使用

shell中函数及循环使用

 

  • 编写一个脚本检测教室的50台主机哪个开着哪个关闭,将打开的ip放在/mnt/ip_up 关闭的ip放在/mnt/ip_down中

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

  • 编写一个脚本实现倒计时

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

  • 编写脚本实现查看文件的类型

shell中函数及循环使用shell中函数及循环使用

输入cat显示dog,输入dog显示cat,其他的依次显示error

shell中函数及循环使用

shell中函数及循环使用

  • 编写一个脚本实现虚拟机的启动--输入相应的命令就可以执行这个虚拟机的操作

shell中函数及循环使用

shell中函数及循环使用

  • 编写一个脚本实现使用这个脚本sh auto_connect.sh 使用ssh服务自动连接到172.25.254.158上
  • 编写一个实现自动问答的脚本

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

shell中函数及循环使用

  • 利用脚本捕捉连接的人的ip和主机名的对应关系

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

shell中函数及循环使用