Running a python script from shell
<p>I want to run a python script from a shell script. I have been able to run it from the "command window" (Cygwin), but now I want to be able to call it from a shell script. It does not work the way I thought it would and the Internet has not really helped me with it.</p>

<p>My code so far:</p>

<pre><code>#!/bin/bash
python Calibrate.py
</code></pre>

<p>I hope someone could help me further. <em>Calibrate</em> just contains a few basic command lines to transform some data that has been read in with an excelreader in the script itself.</p>

<p>A Bash script needs to use the Unix EOL (End Of Line) convention, which terminates each line with <code>\n</code>. But it looks like your test.sh shell script file uses the Windows / DOS EOL convention, which terminates each line with <code>\r\n</code>. </p>

<p>You need to get rid of those <code>\r</code> characters in test.sh, and you need to set your editor to use Unix line endings.</p>

<p>A simple way to strip <code>\r</code> out of a file is to use the Unix <code>sed</code> command; I assume it's available in Cygwin: </p>

<pre><code>sed -i 's/\r//g' test.sh
</code></pre>

<p>This removes all <code>\r</code> characters in test.sh, writing the result back to test.sh</p>

python shell