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
Added per request:
This is what I've written but without success:
runs=5
queries=50
outfile=ReadsAgain.txt
file = open("results.txt", "ab")
print "\n---------------------------------"
print "\n----------- Normal --------------"
print "\n---------------------------------"
file.write("\n----------- Normal --------------\n")
print "\n------------- Query without Index --------------"
file.write("\n------------- Query without Index --------------\n")
for r = 1; r < (%s + 1); r++ % runs
print "Run %s of %s \n" % r % runs
db2 FLUSH PACKAGE CACHE DYNAMIC
output = python reads.py -r1 -pquery1.sql -q$queries -shotelspec -k6 -a5
file.write(output)
file.close()