Quantcast
Channel: Execute python file from shell script based on the cat/awk output - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 2

Execute python file from shell script based on the cat/awk output

$
0
0

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 cats 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.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images