我正在尝试编写一个shell脚本,该脚本将运行需要一些原始输入的python文件。python脚本基本上遵循以下原则:
def main():
name=raw_input("What's your name?")
print "Hello, "+name
main()
Run Code Online (Sandbox Code Playgroud)
我希望shell脚本运行脚本并自动将输入输入到其中。我已经看到了很多方法来从python函数返回的内容中获取shell输入,或者如何从带有输入的python中运行shell,但是这种方法并非如此。基本上,我只想要能做到的事情:
python hello.py
# give the python script some input here
# then continue on with the shell script.
Run Code Online (Sandbox Code Playgroud)