I have a python script called mythicalPythonBindings.py. It outputs something like
Establishing database connection
chanid = 1952
starttime = 2010-09-29 08:12:00
endtime = 2010-09-29 08:30:00
basename = 1952_20100929081200.mpg
stars = 0.0
I need to read this information into variables of the same name in a bash script. My bash script looks like this
#! /bin/bash
/usr/local/bin/mythicalPythonBindings.py --filename='1952_20100929081200.mpg' --DBHostName='192.168.1.110' --DBName='mythconverg' --DBUserName='mythtv' --DBPassword='mythtv' --output=./ReturnFile.txt --display|
while read line
do
case "$line" in
"basename = "* )
echo $line
basename=`echo "$line" |sed s/'basename = '//g`
echo $basename
;;
esac
done
echo $basename
#doing more stuff
The problem is that when setting variables inside the piped output from mythicalPythonBindings.py, it does not export the variables. The statement "echo $basename"(inside the piped output) works, but the seccond "echo $basename"(outside the piped output) does not work.
How can I set these variables for use in the rest of the script?
edit: I need this variable to be used in other commands without saving the data to a file which must be deleted later.