2013年6月26日

shell编程控制结构:expr、let、for、while、until、shift、if、case、break、continue、函数、select

摘要: 1、expr计算整数变量值 格式 :expr arg 例子:计算(2+3)×4的值 1、分步计算,即先计算2+3,再对其和乘4 s=`expr 2 + 3` expr $s \* 4 2、一步完成计算: expr `expr 2 + 3 ` \* 4 –说明: 运算符号和参数之间要有空... 阅读全文

posted @ 2013-06-26 20:19 代码王子 阅读(166) 评论(0) 推荐(0)

shell的shift用法

摘要: 位置参数可以用shift命令左移。比如shift 3表示原来的$4现在变成$1,原来的$5现在变成$2等等,原来的$1、$2、$3丢弃,$0不移动。不带参数的shift命令相当于shift 1。 非常有用的 Unix 命令:shift。我们知道,对于位置变量或命令行参数,其个数必须是确定的,或... 阅读全文

posted @ 2013-06-26 20:16 代码王子 阅读(265) 评论(0) 推荐(0)

shell的case语句简述(shell的流控制)

摘要: shell流控制:http://www.cnblogs.com/yunjiaofeifei/archive/2012/06/12/2546208.html 1、if then else 语句 if then else语句的基本格式如下: if 条件1 then 命令1 elif 条件2 ... 阅读全文

posted @ 2013-06-26 20:11 代码王子 阅读(250) 评论(0) 推荐(0)

shell的case语句

摘要: case语句格式 # vi test.sh : echo "input : " read num echo "the input data is $num" case $num in 1) echo "January";; 双分号结束 2) echo "Feburary";; 5) e... 阅读全文

posted @ 2013-06-26 19:16 代码王子 阅读(842) 评论(0) 推荐(0)

导航