About
The shift utility permits to shift the argument (position parameters).
Articles Related
Syntax
- n is a non-negative number less than or equal to $#. Default to 1.
The positional parameters from n+1 … are renamed to 1 ….
Parameters represented by the numbers $# down to $#-n+1 are unset.
If n is:
- 0, no parameters are changed.
- not given, it is assumed to be 1.
- greater than $#, the positional parameters are not changed.
The return status is greater than zero if n is greater than $# or less than zero; otherwise 0.
Example
Basic
- Run
- Output:
Option Parsing
- Run
- Output: