I'm executing a python file based on the output from the cat
/awk
output.
Say I have a file something like
samp.txt
:
test.py test.conf
dev.py dev.conf
Now I have a small shell script, which cat
s the samp.txt
file and triggers the Python script.
samp.sh
:
OLDIFS=$IFS; IFS=$'\n';for file in $(cat samp.txt) ;
do
text="$file -c $1 -s $2 -t $3"
out=`python $text`
done
When I run the shell script, it says
python: can't open file 'test.py test.conf' : [Errno 2] No such file or directory
The problem is because of the single quotes. Need some suggestions to get over it.