在后台使用HERE_DOC方法运行脚本 [英] Running script with HERE_DOC method in background

查看:97
本文介绍了在后台使用HERE_DOC方法运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应在后台运行的脚本.运行bash时,我必须回答一个问题.该怎么办?

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' &)

推荐答案

<< heredoc是多行的,例如

The << heredoc is multiline, like

somescript <<EOF &
input
EOF

heredoc分隔符应在最后一行单独使用

the heredoc delimiter should be alone on the final line

您可以在<<<中使用一行heredoc,例如:

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

somescript <<<"this coming from stdin" &

这篇关于在后台使用HERE_DOC方法运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆