Shift

Updated: 08/02/2019 by Computer Hope

Shift may refer to any of the following:

1. Shift is the name of a computer keyboard key. See our Shift key page for full information about this key.

2. Shift is a Microsoft command line command that changes the position of replaceable parameters in a batch program. Additional information about this command is found on our shift command page.

3. When referring to a Linux shell, shift is a builtin command of the Bash shell. It shifts the values of command-line arguments for processing in a script. See our bash shift command page for further information.

4. In some programming languages shift is a function that removes the first element of an array. For example, in the Perl code below shift removes "one" from the beginning of the array to make it "two three".

my @example = ('one', 'two', 'three');
shift @example;
 		
print "@example";         #Prints: two three
Tip

If you want to add to the end of an array, use the push function. If you want to remove the first element of the array, use the shift function.

Operating system terms, Programming terms