I am working on a project that has a bunch of c and python files. I am using a menu function using a bash script on a Linux terminal. The bash terminal has some menu options and also puts the files in a loop. I.e. the files are executed cyclically. So, I am doing something like the following in the bash script
#!/bin/bash
PS3='Please enter your choice: '
options=("Loop" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Loop")
echo "Looping the programs"
while [ <some test> ]
do
./cprogram1 arg1 arg2 arg3 ... #calling the c program
python3 pythonprogram1.py #calling the python program
sleep .5 # Waits 0.5 second.
done
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done
say cprogram1 spits out some data cprog1data. How can that data be accessed by the pythonprogram1.py?
One way I thought of was to have a log.txt file from which the C program can write and the python program can read. Is this correct? Are there better and faster ways to do this?