Bash Shell中Shift用法分享
2013-08-02 19:14
1136 查看
shift可以用来向左移动位置参数。
Shell的名字 $0
第一个参数 $1
第二个参数 $2
第n个参数 $n
所有参数 $@ 或 $*
参数个数 $#
shift默认是shift 1
以下边为例:
cat shift.sh
#----------------------------输出文字-开始----------------------------
#!/bin/bash
until [ -z "$1" ] # Until all parameters used up
do
echo "$@ "
shift
done
#----------------------------输出文字-结束----------------------------
sh shift.sh 1 2 3 4 5 6 7 8 9
#----------------------------输出文字-开始----------------------------
1 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9
3 4 5 6 7 8 9
4 5 6 7 8 9
5 6 7 8 9
6 7 8 9
7 8 9
8 9
9
#----------------------------输出文字-结束----------------------------
您可能感兴趣的文章:
相关文章推荐
- Bash Shell中Shift用法分享
- Bash Shell中Shift用法分享
- Bash Shell中Shift用法
- Bash Shell中Shift用法
- js中push(),pop(),unshift(),shift()的用法小结
- UIWebView用法详解及代码分享
- shell的shift用法
- Linux shell脚本中shift的用法说明【转】
- Shell编程中Shift的用法
- MySQL Order By用法分享
- jQuery.each()用法分享
- 分享: eclipse for php development IDE 常用用法
- Shell编程之Shift的用法
- shell中shift和eval的用法
- js数组方法reduce经典用法代码分享
- intro.js 页面引导简单用法 分享
- shell脚本中shift的用法
- easyui的tabs update正确用法分享
- js中push(),pop(),unshift(),shift()的用法小结
- Python中super()函数简介及用法分享