[Tutor] problems with the shebang line and linux
Roel Schroeven
rschroev_nospam_ml at fastmail.fm
Thu Feb 16 18:14:32 CET 2006
Adam schreef:
>
>
> On 16/02/06, *Brian van den Broek* <broek at cc.umanitoba.ca
> <mailto:broek at cc.umanitoba.ca>> wrote:
>
> brian at Cedric:~$ which python
> /usr/bin/python
> brian at Cedric:~$ cd /media/windata/
> brian at Cedric:/media/windata$ ./testerlyfoo.py
> Working!
> brian at Cedric :/media/windata$ ./testerlybar.py
> bash: ./testerlybar.py: /usr/bin/python^M: bad interpreter: No such
> file or directory
>
>
> It seems to me that that ^M is your problem although I'm not quite sure
> where it came from there seems to be an extra character on the end of
> the copied one. Here's a little test I did:
That ^M looks familiar to me: normally it means that the file is in
DOS/Windows format instead of UNIX format, i.e. with CR/LF at the end of
each line instead of only CR. Converting the file with dos2unix or a
similar utility should solve the problem in that case.
I guess it's there because the file comes from a FAT32 file system, and
I presume it has mount options that make the filesystem translate the
line endings automatically (though I don't know if such an option even
exists).
Strange thing is that the problem persists after retyping the file, but
I guess that's because the editor was still in CR/LF mode. Did you
create a new file before starting to retype, or did you just clear
everything?
--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton
Roel Schroeven
More information about the Tutor
mailing list