Shell shift procedure - What is this?

后端 未结 5 1798
天命终不由人
天命终不由人 2021-02-05 08:45

In shell we have the command shift, but i saw on some example its giving shift 3

Why there is a number after shift ? and what its about ? what it does ?

Example:

5条回答
  •  故里飘歌
    2021-02-05 09:09

    This would be answered simply by reading either the Bash manual, or typing man shift:

          shift [n]
    

    Shift the positional parameters to the left by n. The positional parameters from n+1 ... $# are renamed to $1 ... $#-n. Parameters represented by the numbers $# to $#-n+1 are unset. n must be a non-negative number less than or equal to $#. If n is zero or greater than $#, the positional parameters are not changed. If n is not supplied, it is assumed to be 1. The return status is zero unless n is greater than $# or less than zero, non-zero otherwise.

提交回复
热议问题