in reply to Re: Using -- to terminate switch processing
in thread Using -- to terminate switch processing
What (potential) errors does the addition of the '--' prevent?
On systems that do depend on the shebang to find the executable, a stray carriage return (as so often happens when transferring files from Windows to Unix) can break that magic. Adding -- in such cases ensures that the trailing ^M never interferes with the binary name. Then again, adding ANY switch seems to accomplishes the same...
$ cat -e cM.pl #!/usr/bin/perl^M$ ^M$ print "Hello, World!";^M$ $ ./cM.pl : bad interpreter: No such file or directory $ cat -e cM--.pl #!/usr/bin/perl --^M$ ^M$ print "Hello, World!";^M$ $ ./cM--.pl Hello, World!
--k.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:^3 Using -- to terminate switch processing
by bsb (Priest) on Mar 30, 2003 at 05:02 UTC |