【发布时间】:2015-02-14 01:45:30
【问题描述】:
我有一个 bash 脚本 start.sh,它调用另一个 run.sh,这将我带到另一个提示,我必须删除一个文件 file.txt,然后退出该提示。
当我从start.sh 内部调用run.sh 时,我看到了提示并且我相信它会删除file.txt 但内部/新提示等待我在脚本运行时退出它 - 意思它需要干预才能进行。如何在 bash 中避免它?
在 Python 中,我可以使用 Popen 并开始使用,但不确定 bash。
编辑:我想知道提供什么命令来退出 shell(从运行 run.sh 生成),这样我就可以回到启动“start.sh”的提示符。
Etan:回答你的问题
VirtualBox:~/Desktop/ > ./start
company@4d6z74d:~$ ->this is the new shell
company@4d6z74d:~$ logout ---> I did a "Control D here" so the script could continue.
start.sh 的相关部分:
/../../../../run.sh (this is the one that takes us to the new $ prompt)
echo "Delete file.txt "
rm -f abc/def/file.txt
【问题讨论】:
-
run.sh如何提示输入?可以显示run.sh的相关部分吗?