脚本编程: 顺序结构 选择结构 if case 循环结构 for while until while循环:适用于循环次数未知的场景,要有退出条件语法: while CONDITION; do statement ... done 计算100以内所有正整数的和 #!/bin/bashdeclare -i I=1declare -i SUM=0 while [
shell编程中条件表达式的使用 if 条件then Commandelse Commandfi 别忘了这个结尾 If语句忘了结尾fitest.sh: line 14: syntax error: unexpected end of fi if 的三种条件表达式 ifcommandthen if 函数then 命令执行成功,等于返回0 (比如grep ,找到匹配)执行失败,返回非0 (grep,没找到匹配) if [ expressi