# shift

*noun*

say it: **“SHIFT”** **/ˈʃɪft/**

A bash command that drops the first argument, so the second becomes the first and the count goes down by one.

## What does **shift** do in bash?

`shift` drops the first argument, and the rest move down one, like a line at a counter moving up: `$2` becomes `$1`, and `$#` goes down by one. A script with subcommands uses it to drop the command's word before handing the rest on.

```bash
words() {
  echo "$# words, the first is $1"
  shift
  echo "$# words, the first is $1"
}
words list -c dinner
# 3 words, the first is list
# 2 words, the first is -c
```

## In a sentence

- “After **shift**, $1 was -c instead of list.”
- “The recipes script uses **shift** to hand cmd_list only its own options.”

Level: Journeyman · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=3)

Updated: November 10, 2026

Source: https://www.ask-codey.com/glossary/shift-unix
