From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Why sh-set-shell insert a space after #! Date: Fri, 17 Aug 2012 16:18:07 +0900 Message-ID: <87y5levvf4.fsf@uwakimon.sk.tsukuba.ac.jp> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1345187900 20972 80.91.229.3 (17 Aug 2012 07:18:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 07:18:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 17 09:18:20 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T2Gp1-0000sj-Id for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2012 09:18:19 +0200 Original-Received: from localhost ([::1]:41259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Gp0-0004Qz-AT for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2012 03:18:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Gox-0004Qu-D4 for emacs-devel@gnu.org; Fri, 17 Aug 2012 03:18:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2Gow-0005Wn-Bo for emacs-devel@gnu.org; Fri, 17 Aug 2012 03:18:15 -0400 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:52565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Gow-0005WH-1P for emacs-devel@gnu.org; Fri, 17 Aug 2012 03:18:14 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 86CB097088E; Fri, 17 Aug 2012 16:18:07 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 4BCA211F839; Fri, 17 Aug 2012 16:18:07 +0900 (JST) In-Reply-To: X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta31) "ginger" b4715fcbe001 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.158.97.224 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152607 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.