Back to Developer Roadmap

Shift

src/data/roadmaps/shell-bash/content/shift@u_kpVb3V8Xp-0fex_5-yG.md

4.0593 B
Original Source

Shift

The shift command in shell scripting renames the command-line arguments. Specifically, it moves each argument one position to the left. The value of $2 becomes $1, the value of $3 becomes $2, and so on. The original value of $1 is lost. This is particularly useful when you need to process a variable number of arguments passed to a script.

Visit the following resources to learn more: