* Why sh-set-shell insert a space after #!
@ 2012-08-17 4:05 Leo
2012-08-17 5:22 ` Thierry Volpiatto
2012-08-17 7:18 ` Stephen J. Turnbull
0 siblings, 2 replies; 12+ messages in thread
From: Leo @ 2012-08-17 4:05 UTC (permalink / raw)
To: emacs-devel
Hello all,
If you M-x sh-set-shell in a buffer it inserts something like:
#! /bin/bash
I am curious why a space after #!. I read this page:
http://en.wikipedia.org/wiki/Shebang_(Unix). The newsgroup post by
Dennis Ritchie also has a space. But most scripts I have seen do not. So
I am curious ;)
Leo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Why sh-set-shell insert a space after #!
2012-08-17 4:05 Why sh-set-shell insert a space after #! Leo
@ 2012-08-17 5:22 ` Thierry Volpiatto
2012-08-17 6:54 ` Leo
2012-08-24 17:08 ` Aurélien Aptel
2012-08-17 7:18 ` Stephen J. Turnbull
1 sibling, 2 replies; 12+ messages in thread
From: Thierry Volpiatto @ 2012-08-17 5:22 UTC (permalink / raw)
To: emacs-devel
Leo <sdl.web@gmail.com> writes:
> Hello all,
>
> If you M-x sh-set-shell in a buffer it inserts something like:
>
> #! /bin/bash
>
> I am curious why a space after #!. I read this page:
> http://en.wikipedia.org/wiki/Shebang_(Unix). The newsgroup post by
> Dennis Ritchie also has a space. But most scripts I have seen do not. So
> I am curious ;)
Seems that this is wrong:
http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Magic_number
http://www.in-ulm.de/~mascheck/various/shebang/#details
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 12+ messages in thread
* Why sh-set-shell insert a space after #!
2012-08-17 4:05 Why sh-set-shell insert a space after #! Leo
2012-08-17 5:22 ` Thierry Volpiatto
@ 2012-08-17 7:18 ` Stephen J. Turnbull
2012-08-17 8:05 ` Andreas Schwab
2012-08-17 15:50 ` Leo
1 sibling, 2 replies; 12+ messages in thread
From: Stephen J. Turnbull @ 2012-08-17 7:18 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
Leo writes:
> Hello all,
>
> If you M-x sh-set-shell in a buffer it inserts something like:
>
> #! /bin/bash
>
> I am curious why a space after #!. I read this page:
> http://en.wikipedia.org/wiki/Shebang_(Unix). The newsgroup post by
> Dennis Ritchie also has a space. But most scripts I have seen do not. So
> I am curious ;)
IIRC, POSIX allows but doesn't require the space. However, some
historical mostly-compatible shells had problems if there was no
space. Since it never hurts with fully conforming shells, and
sometimes helps, it's a definite portability win. (AFAIK there was no
particular correlation between this kind of non-conformance and other,
more important, non-conformance.)
Although it's not needed for bash, you can argue for it from
simplicity of sh-mode implementation (you don't need to detect the
shell and maintain a list of which shells care to decide whether to
insert the space) and consistency of style.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Why sh-set-shell insert a space after #!
2012-08-17 7:18 ` Stephen J. Turnbull
@ 2012-08-17 8:05 ` Andreas Schwab
2012-08-17 15:50 ` Leo
1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2012-08-17 8:05 UTC (permalink / raw)
To: Stephen J. Turnbull; +Cc: Leo, emacs-devel
"Stephen J. Turnbull" <stephen@xemacs.org> writes:
> IIRC, POSIX allows but doesn't require the space. However, some
> historical mostly-compatible shells had problems if there was no
> space.
There is some background information in
<http://www.in-ulm.de/~mascheck/various/shebang/#blankrequired>.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Why sh-set-shell insert a space after #!
2012-08-17 7:18 ` Stephen J. Turnbull
2012-08-17 8:05 ` Andreas Schwab
@ 2012-08-17 15:50 ` Leo
2012-08-17 16:37 ` Thierry Volpiatto
1 sibling, 1 reply; 12+ messages in thread
From: Leo @ 2012-08-17 15:50 UTC (permalink / raw)
To: Stephen J. Turnbull; +Cc: emacs-devel
On 2012-08-17 15:18 +0800, Stephen J. Turnbull wrote:
> IIRC, POSIX allows but doesn't require the space. However, some
> historical mostly-compatible shells had problems if there was no
> space. Since it never hurts with fully conforming shells, and
> sometimes helps, it's a definite portability win. (AFAIK there was no
> particular correlation between this kind of non-conformance and other,
> more important, non-conformance.)
From my reading of the two links, separation #! and the path with a
space is abnormal and evidenced by all scripts I can find. So I think
the better default for executable-prefix is "#!", not "#! ".
Leo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Why sh-set-shell insert a space after #!
2012-08-17 15:50 ` Leo
@ 2012-08-17 16:37 ` Thierry Volpiatto
0 siblings, 0 replies; 12+ messages in thread
From: Thierry Volpiatto @ 2012-08-17 16:37 UTC (permalink / raw)
To: emacs-devel
Leo <sdl.web@gmail.com> writes:
> On 2012-08-17 15:18 +0800, Stephen J. Turnbull wrote:
>> IIRC, POSIX allows but doesn't require the space. However, some
>> historical mostly-compatible shells had problems if there was no
>> space. Since it never hurts with fully conforming shells, and
>> sometimes helps, it's a definite portability win. (AFAIK there was no
>> particular correlation between this kind of non-conformance and other,
>> more important, non-conformance.)
>
> From my reading of the two links, separation #! and the path with a
> space is abnormal and evidenced by all scripts I can find. So I think
> the better default for executable-prefix is "#!", not "#! ".
Agree, also in all books, manuals I found , it is described like "#!/bin/bash"
and never "#! /bin/bash", same for python.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-08-24 17:08 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 4:05 Why sh-set-shell insert a space after #! Leo
2012-08-17 5:22 ` Thierry Volpiatto
2012-08-17 6:54 ` Leo
2012-08-17 7:06 ` Leo
2012-08-22 17:17 ` Bastien
2012-08-23 0:53 ` Leo
2012-08-23 9:54 ` Bastien
2012-08-24 17:08 ` Aurélien Aptel
2012-08-17 7:18 ` Stephen J. Turnbull
2012-08-17 8:05 ` Andreas Schwab
2012-08-17 15:50 ` Leo
2012-08-17 16:37 ` Thierry Volpiatto
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.