Converting a bash script to python (small script)
Posted
by Mestika
on Stack Overflow
See other posts from Stack Overflow
or by Mestika
Published on 2010-05-15T10:47:53Z
Indexed on
2010/05/15
10:54 UTC
Read the original article
Hit count: 401
Hi,
I’ve a bash script I’ve been using for a Linux environment but now I have to use it on a Windows platform and want to convert the bash script to a python script which I can run.
The bash script is rather simple (I think) and I’ve tried to convert it by google by way around but can’t convert it successfully.
The bash script looks like this:
runs=5
queries=50
outfile=outputfile.txt
date >> $outfile
echo -e "\n---------------------------------"
echo -e "\n----------- Normal --------------"
echo -e "\n---------------------------------"
echo -e "\n----------- Normal --------------" >> $outfile
for ((r = 1; r < ($runs + 1); r++))
do
echo -e "Run $r of $runs\n"
db2 FLUSH PACKAGE CACHE DYNAMIC
python reads.py -r1 -pquery1.sql -q$queries -shotelspec -k6 -a5 >> $outfile
done
The main command, the python read.py … etc. is another python file I’ve been given and have the arguments as you see.
I know it is a lot to ask for, but it would really help me out if someone could convert this to a python script I can use or at least give me some hints and directions.
Sincerely
Mestika
© Stack Overflow or respective owner