简体   繁体   中英

How to run an interactive python script inside a shell script?

I need to call a python tool (buttons.py), inside my shell script (emailsend.sh). The tricky part is this python tool is written in interacive mode. This is how I manually trigger tool button.py:

./button.py (which put users in the screen interactive console, and on it, I need to type the following:)

>>> tsr()
>>> tl()  
>>> activate(355)

Is there a way to embed all that inside my emailsend.sh script?

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM