Bash shift

From NovaOrdis Knowledge Base
Revision as of 01:40, 24 September 2017 by Ovidiu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Overview

This built-in command takes 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. The first n positional parameters are thrown away.

If the number is not present, it is assumed to be 1.

If n is zero or greater than $#, the positional parameters are not changed and the command has no effect.