Shift

Updated: 02/04/2024 by Computer Hope

Shift may refer to any of the following:

1. In general, shift describes a small movement or a cause in movement.

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

3. In binary, a shift refers to either a left shift or right shift. See our binary page for further information about these shifts.

4. 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.

5. With 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.

6. With data in general, shift refers to how data is moved around an area when something is added or removed. For example, in Microsoft Excel, when a new cell is added or removed, data around that cell is shifted to accommodate the cell addition or cell loss.

7. In some programming languages, shift is a function that removes the first element of an array. For example, 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

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

Note

In Perl, if an array is omitted, shift operates on the @ARGV (@_) array.

Operating system terms, Programming terms