1

So, I have this small simple shell script called refre.sh that will update from svn and call a Django command:

echo "Refresh..."
svn update
python manage.py collectstatic --noinput --settings=settings.prod

When I execute the script with ./refre.sh, will output:

Refresh...
'nknown command: 'update
Type 'svn help' for usage.
Unknown command: 'collectstatic'
Type 'manage.py help' for usage.

but when I'm typing the commands manually in the shell, I get the correct output.

This lead me to think that there is a environment problem or something like this, because I have Django installed locally, and not using the global installation (also python is locally installed, but I've put the full path to the correct python, and it didn't help).

So, do I have to set some environment variables or what am I missing ?

2
  • how are you executing that script? Commented Apr 22, 2011 at 14:19
  • the script is called refresh.sh so I call it ./refresh.sh Commented Apr 22, 2011 at 14:24

1 Answer 1

3

First of all you should have #!/bin/sh before first line of the script.

And of course you have to check that editor that you're using saves UNIX line endings (\n) rather than Windows ones (\r\n).

Sign up to request clarification or add additional context in comments.

3 Comments

did this, and it only deepened the mystery: now it says: "sh: ./refre.sh: /bin/sh^M: bad interpreter: No such file or directory". Have no clue as what that "^M" is ~X(
^M is \r, in other words DOS/Windows line ending. What are you using to edit this file?
That was it!!! Windows new line problem. Can you post this as an answer instead of a comment, so everybody else will see it ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.