next up previous contents
Next: 外部命令 Up: 內建命令 Previous: trap   Contents

shift

shift是用來把進來的arguments移一個位移, shift n 移n個位移, shift可以拿來用超過10個以上的argrments,因為$1 ... $9只有9個而已。 來看一個shell的queue list的append
    # list_append list_name item ... - append items to a list
    list_append()
    {
        _list_a_name=$1; shift
        eval "set -- \${$_list_a_name} \$*"
        eval "$_list_a_name=\$*"
    }



Cyril Huang 2002-06-14