11

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
  • 37,241
  • 25
  • 195
  • 267
MLSC
  • 5,872
  • 8
  • 55
  • 89
  • 2
    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

24

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" &
clt60
  • 62,119
  • 17
  • 107
  • 194