[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Magic Shebang not cross platform compatible?

From: jflorian
Subject: Magic Shebang not cross platform compatible?
Date: Wed, 1 Oct 2003 10:21:37 -0400

I've found that if bash scripts (or python and probably many more) use the 
magic shebang trick as in the following example:

#!/usr/bin/env sh

and the file is written in DOS format with CR/LF endings such is as very 
common with bash scripts under Cygwin or Python scripts that originated 
from the DOS world they don't work under the *nix world.  It appears that 
the CR becomes part of the name for the interpreter to use as evidenced by 
this output from the attached script:

$ ./test 2>&1 | od -c
0000000   /   u   s   r   /   b   i   n   /   e   n   v   :       s   h
0000020  \r   :       N   o       s   u   c   h       f   i   l   e
0000040   o   r       d   i   r   e   c   t   o   r   y  \n

While I certainly would not claim this is a bug, it does seem like it 
could be handled gracefully.

John Florian
Kennedy Technologies

517.646.6928 ext. 103

reply via email to

[Prev in Thread] Current Thread [Next in Thread]