Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

What does , mean in bash? For example what would the , in "accurev update -9 2>,update 1>&2" mean? (accurev is a version control software)

Sorry for the lame question, I just dunno how to google for special characters.

share|improve this question
I bet it means someone's finger slipped while typing the > character. – stib Nov 18 '12 at 12:41
up vote 4 down vote accepted

It has no special meaning. The command redirects to a file called ,update.

share|improve this answer

A comma can be used in brace expansion, but there are no braces in the example you show.

This command would store its output in two files, one called "def" and the other called "abcdef":

echo hello | tee {,abc}def

or this one in "file1" and "file2":

echo hello | tee file{1,2}

Commas can be used to separate commands in an arithmetic operation in a let statement or the equivalent (()) construction:

let a=1,b=2    # no spaces permitted
(( a = 1 , b = 2 ))
(( ++c, --d, e+=4 ))

You can use commas in a for statement to work with additional variables besides the primary index rather than putting the variable manipulation in the body of the for. It's probably bad programming practice to do this:

for ((i=1,j=4; i<4,j<7; i++,j+=2)); do echo $i $j; done

Commas can also be used in Bash 4 to change a string to lowercase (only a couple of variations are shown):

$ words="This is a TEST"
$ echo ${words,,}  # the whole string is lowercased
this is a test
$ echo ${words,}   # only the first character
this is a TEST
share|improve this answer
One file descriptor can only be redirected to one file. > {abc,def} would fail with "Ambiguous redirect". (For several files, tee is usually used.) – grawity Sep 4 '10 at 14:26
@grawity: Of course you are correct. I've corrected my answer. – Dennis Williamson Sep 4 '10 at 14:55

Dennis is right in general, but your specific example runs accurev update -9, and puts the stderr output into a file called ,update (with , as part of the filename), then puts stdout to the same place that stderr goes to (the file named ,update in this case).

share|improve this answer

there is a comma operator in bash that will run two commands but I don't believe it is used by your example check out the advanced bash scripting guide

an example:

for ((a=1, b=1; a <= LIMIT ; a++, b++))
do  # The comma chains together operations.
  echo -n "$a-$b "
share|improve this answer
There isn't. Bash uses a semicolon for that ; – grawity Sep 4 '10 at 14:25
@grawity: There is, but it's limited to arithmetic "commands" (see my answer). – Dennis Williamson Sep 4 '10 at 14:56
if you look at the scripting guide you will see that there is a comma operator - see my updated answer – Adam Butler Sep 4 '10 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .