《unix-os教课件》第五章 shell程序设计.pptVIP

  • 7
  • 0
  • 约1.41万字
  • 约 55页
  • 2018-12-02 发布于浙江
  • 举报

《unix-os教课件》第五章 shell程序设计.ppt

《unix-os教课件》第五章 shell程序设计

if-then-fi 的运行结果 [root@stu1 no11]# ./6_shell.sh 6.1_shell.sh File 6.1_shell.sh exists [root@stu1 no11]# ./6_shell.sh no11 File no11 is a directory if-then-else-fi 语句 语法结构为: if [ 表达式 ] then 命令表1 else 命令表2 fi 如果表达式为真, 则执行命令表1中的命令, 退出if 语句; 否则执行命令表2中的语句, 退出if语句。 if-then-else-fi 例子 例子:shell程序6.1_shell.sh,测试输入的字符串是否是已存在的文件或目录名. #! /bin/bash echo input a filename: read filename if [ -d $filename ] then

文档评论(0)

1亿VIP精品文档

相关文档