I am trying to execute the following command at shell prompt:
nohup s开发者_运维技巧qlplus DB_ID/DB_PWD@DOMAIN @main.sql 490 >> result.out 2>>&1 &
main.sql is a sql script that accepts 490
as argument.
I get error:
bash: syntax error near unexpected token `&'
What is wrong with the syntax?
The syntax error comes from your redirection of STDERR to STDOUT. The required (and only valid) syntax is 2>&1
. It still does what you expect from it. The >>
you do in the STDOUT redirection only helps for actual files and prevents the file data to be erased. For pipe redirection, this is not required and not even allowed syntax-wise.
The final correct syntax is
nohup sqlplus DB_ID/DB_PWD@DOMAIN @main.sql 490 >> result.out 2>&1 &
精彩评论