8/12/2016

bash built-in "shift"

shift 是將指令列上的參數位置做移動的指令。

ex:


$0= xxx                               $0= zzz
$1= yyy              shift 2       $1= ppp
$2= bbb            ======>   $2= qqq      
$3= ppp                               $3= null
$4= qqq                               $4= null

xxx and yyy were shifted out of the order, it'd been thrown away.

ps: Linux 實戰手冊 18-3-3