Skip to main content
added 72 characters in body
Source Link
Akshay Patil
  • 815
  • 2
  • 8
  • 11

I was studying a bash script code where I encountered operator "&>>". I didn't understand its use. So, I referred to http://www.gnu.org/software/bash/manual/html_node/Redirections.html .

It is semantically equivalent to >> file 2>&1 .

Following is the output from my shell :-

# echo $SHELL
/bin/bash
# echo "hello" &>> file1
bash: syntax error near unexpected token `>'

and

# echo "hello" >> file1 2>&1

# cat file1 

hello

Question :- Why am I getting error bash: syntax error near unexpected token '>' ?

[EDIT] :- Bash version 3.2.25(1)-release (x86_64-redhat-linux-gnu)

I was studying a bash script code where I encountered operator "&>>". I didn't understand its use. So, I referred to http://www.gnu.org/software/bash/manual/html_node/Redirections.html .

It is semantically equivalent to >> file 2>&1 .

Following is the output from my shell :-

# echo $SHELL
/bin/bash
# echo "hello" &>> file1
bash: syntax error near unexpected token `>'

and

# echo "hello" >> file1 2>&1

# cat file1 

hello

Question :- Why am I getting error bash: syntax error near unexpected token '>' ?

I was studying a bash script code where I encountered operator "&>>". I didn't understand its use. So, I referred to http://www.gnu.org/software/bash/manual/html_node/Redirections.html .

It is semantically equivalent to >> file 2>&1 .

Following is the output from my shell :-

# echo $SHELL
/bin/bash
# echo "hello" &>> file1
bash: syntax error near unexpected token `>'

and

# echo "hello" >> file1 2>&1

# cat file1 

hello

Question :- Why am I getting error bash: syntax error near unexpected token '>' ?

[EDIT] :- Bash version 3.2.25(1)-release (x86_64-redhat-linux-gnu)

Source Link
Akshay Patil
  • 815
  • 2
  • 8
  • 11

What is the use of "&>>" in bash?

I was studying a bash script code where I encountered operator "&>>". I didn't understand its use. So, I referred to http://www.gnu.org/software/bash/manual/html_node/Redirections.html .

It is semantically equivalent to >> file 2>&1 .

Following is the output from my shell :-

# echo $SHELL
/bin/bash
# echo "hello" &>> file1
bash: syntax error near unexpected token `>'

and

# echo "hello" >> file1 2>&1

# cat file1 

hello

Question :- Why am I getting error bash: syntax error near unexpected token '>' ?