10

I have a script that should be run in background. I must answer a question as soon as I run the bash..How can I do that?

(nohup python script.py lst '<<HERE yes HERE' &)
Cœur
  • 34,719
  • 24
  • 185
  • 251
MLSC
  • 5,584
  • 7
  • 49
  • 85
  • 1
    If you just need a single line of input, `echo yes | nohup python gpvul.py lst &` is simpler. The parentheses are unnecessary even with your current code. – tripleee Aug 16 '14 at 06:41

1 Answers1

22

The << heredoc is multiline, like

somescript <<EOF &
input
EOF

the heredoc delimiter should be alone on the final line

You can use one line heredoc with <<<, like:

somescript <<<"this coming from stdin" &
jm666
  • 58,683
  • 17
  • 101
  • 180