Search code examples
pythoncygwin

invalid Syntax rm -rf temp (Cygwin)


Shell/OS: Cygwin/Windows 7

Source code: Source code

Required package: Required package


Installation:

I downloaded the following Source code on windows. I moved the requited package to models and I installed the package by using the following command: python setup.py install


Test:

by using Cygwin I wanted to test the package by typing: ./run-test:

#!/cygdrive/c/Python27/python

rm -rf temp
ocropus-nlbin tests/testpage.png -o temp
ocropus-gpageseg 'temp/????.bin.png'
ocropus-rpred -n 'temp/????/??????.bin.png'
ocropus-hocr 'temp/????.bin.png' -o temp.html
ocropus-visualize-results temp
ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html

echo "to see recognition results, type: firefox temp.html"
echo "to see correction page, type: firefox temp-correction.html"
echo "to see details on the recognition process, type: firefox temp/index.html"

Error:

File "./run-test", line 3
    rm -rf temp
              ^
SyntaxError: invalid syntax

  • What caused this error?

Solution

  • The #! line says this is a Python script. So why would a shell command be acceptable syntactically?

    Try #!/bin/sh/ instead.