Bash shift
Jump to navigation
Jump to search
External
Internal
Overview
This command one number as argument and shifts the positional parameters to the left by that number. The positional parameters from n + 1 to $# are renamed to variable names from $1 to $# - N+1.
Say you have a command that takes 10 arguments, and N is 4, then $4 becomes $1, $5 becomes $2 and so on. $10 becomes $7 and the original $1, $2 and $3 are thrown away.
If N is zero or greater than $#, the positional parameters are not changed (the total number of arguments, see Section 7.2.1.2) and the command has no effect. If N is not present, it is assumed to be
Also see