Reputation: 73
I'm new to Python and have been able to find answers to most of my questions here so I thought you guys could help me with this one:
I'm developing somewhat of a hybrid application using bash scripts to show menus and to call python applications (I'm doing it this way to simplify things).
My problem is that when I end the python application, it simply terminates the process and to go back to the menus, I have to start the whole program again. I tried using "subprocess.call('xxx')" but it opens the bash scrips inside of the application I am running and shows text (echo) only, no other functions.
Is there a way to end the python application first and then call the shell script?
Upvotes: 0
Views: 418
Reputation: 47099
You can wrap your code in a while-true loop
while :; do
# Assuming you want to show the menu before you start a program:
bash showMenu.py
python myScript.py
# When the above scripts exits the process will start all over again
# You might want to consider checking the exit code and only continue if the program exits with status code 0
# [ $? gt 0 ] && break
done
Upvotes: 1