Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have some command:

somecommand "$@"

What is the significance of $@? It must be some unix trickery that I'm not familiar with. Unfortunately, since its all punctuation, I can't google it either.

share|improve this question
up vote 5 down vote accepted

It's the current shell script's or function's parameters, individually quoted.

man bash says:

@ Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ...

Given the following script:

#!/usr/bin/env bash

function all_args {
    # repeat until there are no more arguments
    while [ $# -gt 0 ] ; do
        # print first argument to the function
        echo $1
        # remove first argument, shifting the others 1 position to the left

echo "Quoted:"
all_args "$@"
echo "Unquoted:"
all_args $@

This happens when executed:

$ ./ foo bar "baz qux"
baz qux
share|improve this answer
You can btw find it by searching for \$@ in man bash. You need to escape the dollar character. – Daniel Beck Nov 28 '11 at 19:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.