I want to run the following lines of linux bash commands inside a python program.
tail /var/log/omxlog | stdbuf -o0 grep player_new | while read i
do
Values=$(omxd S | awk -F/ '{print $NF}')
x1="${Values}"
x7="${x1##*_}"
x8="${x7%.*}"
echo ${x8}
done
I know that for a single-line command, we can use the following syntax:
subprocess.call(['my','command'])
But, how can I use subprocess.call if there are several commands in multiple lines !?
tail /var/log/omxlog | stdbuf -o0 grep plater_new | while read i; do Values=$(omxd S | awk -F/ '{print $NF}'); x1="${Values}";...and so on. It certainly isn't very readable, but it should work. Is there any reason you couldn't have a bash script to run instead?/var/log/omxlogand executeomxddirectly in python?bashseems to be unnecessary here.