Shift positional parameters.
shift [n]
$n, $n+1... to $1, $2....n (optional): An integer greater than or equal to 1 and less than or equal to the number of parameters, defaulting to 1.
Returns success unless n is greater than the number of parameters or n is less than 1, or other illegal values.
Suppose our script file (test.sh) is as follows:
#!/usr/bin/env bash
# Display the first three positional parameters.
echo "$1 $2 $3"
# Remove the first two positional parameters, rename $3 to $1, and so on.
shift 2
echo "$1 $2 $3"
Execute the script in the terminal:
sh test.sh q w e r t
The output is as follows:
q w e
e r t
help command.