欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Bash Shell中Shift用法分享

 更新時間:2013年08月02日 19:14:47   作者:  
這篇文章主要介紹了Bash Shell中Shift的使用方法,需要的朋友可以參考下

shift可以用來向左移動位置參數(shù)。
Shell的名字 $0
第一個參數(shù) $1
第二個參數(shù) $2
第n個參數(shù) $n
所有參數(shù) $@ 或 $*
參數(shù)個數(shù) $#

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
#----------------------------輸出文字-結束----------------------------

相關文章

最新評論