摘要: 2.2 条件及控制结构 条件: test 或 [命令。 当使用[命令时,还需要使用]来结尾。 test命令的退出码(表明条件是否被满足)决定是否需要执行后面的条件代码。 例如: if test -f fred.cthen echo "test success"fiif [ -f fred.c ]then echo "test success"fiif [ -f fred.c ]; then echo "test success"fi 注意: 1.[和被检查的条件之间必须留出空格; 2.then可和if放在一行,但必须在前面加分号 条件 阅读全文
posted @ 2014-03-14 22:48 尘虑萦心 阅读(207) 评论(0) 推荐(0) 编辑