What Is Shift Command in Linux?
Contents the Shift Command in Unix Is Used to Move the Command Line Arguments to One Position Left. the First Argument Is Lost When You Use the Shift Command...
The shift command in UNIX is used to move the command line arguments to one position left. The first argument is lost when you use the shift command. Shifting command line arguments is useful when you perform a similar action to all arguments one-by-one, without changing the variable name.
What is shift command?
The shift command is one of the Bourne shell built-ins that comes with Bash. This command takes one argument, a number. The positional parameters are shifted to the left by this number, N. … Say you have a command that takes 10 arguments, and N is 4, then $4 becomes $1, $5 becomes $2 and so on.
Must Read
What does shift do in Linux?
Shift is a builtin command in bash which after getting executed, shifts/move the command line arguments to one position left. The first argument is lost after using shift command. This command takes only one integer as an argument.