shift:tldr:f0bc3
The command "shift ${N}" is used in Shell scripting to shift the positional parameters to the left by N positions.
In a Shell script, the positional parameters are the arguments passed to the script when it is executed. By default, the first argument is stored in $1, the second in $2, and so on.
For example, if you have a script named "myscript.sh" and you execute it with three arguments like this:
./myscript.sh arg1 arg2 arg3
Inside the script, you can access these arguments using $1, $2, and $3 respectively.
Now, the "shift" command allows you to move or shift the positional parameters to the left by a specified number of positions. In this case, ${N} represents the number of positions to shift.
So, if you execute the command "shift 2" inside the script, the positional parameters are shifted two positions to the left. The value of $1 becomes "arg2", the value of $2 becomes "arg3", and $3 becomes unset or empty.
This command is primarily used when you want to discard the first few arguments and work with the remaining arguments without changing their respective positions.