'Bash: "syntax error near unexpected token" that's a valid token
I have the following bash code in a script file:
if [ 'false' == 'true' ]
then
write_map() >> 'groups.txt'
Groups='groups.txt'
fi
When I try to run the script, I get this message from bash, and nothing is run:
syntax error near unexpected token `>>'
- Why is >> an "unexpected token?
- Why is bash failing on code that is inside an "if" that won't be run?
- This bash code was created by Cromwell wdl. write_map is a wdl function, not a bash function. Could that be what's breaking bash?
Solution 1:[1]
So, there were two issues
- write_map was being called wrong in the wdl code that was the source for this bash code
- When called correctly, write_map is turned into a file, and you can't >> a file (you have to cat it then >>)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Greg Dougherty |
