shebang strange thing...
bignose-hates-spam at and-zip-does-too.com.au
Tue Jun 24 02:25:20 CEST 2003
On 23 Jun 2003 16:29:44 -0700, Dan Bishop wrote:
> mwilson at the-wire.com (Mel Wilson) wrote:
>> It's understandable once you realize that the shell thinks the '\r'
>> is part of the filename. Just like
>> os.execv ('/usr/bin/python\r', ('myfile.py',))
> But how many people use \r at the end of filenames? Or are even aware
> that they can?
> Even if it isn't a bug, it's a feature that causes more harm than
You seem to be under the impression that this is some "process the \r at
the end of the filename" feature. It isn't. The kernel will treat
everything from the shebang to the linefeed as the command-line to be
used; there's no special "feature" specifically spotting a rogue
character and tripping the foolish user up.
This is simple, known, documented behaviour. If other systems place
foreign characters in the shebang line, it's up to the *user* to know
that; the kernel does what it's told. I certainly don't want the kernel
having special-case, workaround code for line-ending confusions that are
nothing to do with it.
When writing shell scripts, there are many things to learn; line endings
is but one of them. When moving files between operating systems, there
are many things to learn; the differences in line endings is but one of
It's not the job of the kernel to protect the user from herself. That's
the job of userspace programs -- or meatspace processes :-)
\ "A man may be a fool and not know it -- but not if he is |
`\ married." -- Henry L. Mencken |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
More information about the Python-list