Bash shift

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.