Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

4 Answers 4

up vote 3 down vote accepted

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

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 http://tldp.org/LDP/abs/html/ops.html

an example:

for ((a=1, b=1; a <= LIMIT ; a++, b++))
do  # The comma chains together operations.
  echo -n "$a-$b "
done
share|improve this answer
    
There isn't. Bash uses a semicolon for that ; –  grawity Sep 4 '10 at 14:25
1  
@grawity: There is, but it's limited to arithmetic "commands" (see my answer). –  Dennis Williamson Sep 4 '10 at 14:56
1  
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

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

Your Answer

 
discard

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.