如何在shell脚本中运行交互式python脚本?

如何在shell脚本中运行交互式python脚本?,python,shell,Python,Shell,我需要在shell脚本(emailsend.sh)中调用python工具(buttons.py)。棘手的是,这个python工具是以交互模式编写的。这是我手动触发tool button.py的方式: /button.py(它将用户放在屏幕交互控制台中,我需要在上面键入以下内容:) 有没有办法将所有这些内容嵌入到我的emailsend.sh脚本中?试试以下方法: ./button.py << EOF tsr() tl() activate(355) EOF /button.py如果p

我需要在shell脚本(emailsend.sh)中调用python工具(buttons.py)。棘手的是,这个python工具是以交互模式编写的。这是我手动触发tool button.py的方式:

/button.py
(它将用户放在屏幕交互控制台中,我需要在上面键入以下内容:)

有没有办法将所有这些内容嵌入到我的emailsend.sh脚本中?

试试以下方法:

./button.py << EOF
tsr()
tl()
activate(355)
EOF

/button.py如果python脚本不太长,请将其上载到此处,您会得到更好的帮助。
./button.py << EOF
tsr()
tl()
activate(355)
EOF