unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Bob Proulx <bob@proulx.com>
To: help-gnu-emacs@gnu.org
Subject: Re: --script and --quick
Date: Tue, 26 May 2015 14:53:47 -0600	[thread overview]
Message-ID: <20150526142445521942652@bob.proulx.com> (raw)
In-Reply-To: <87iobfs202.fsf@web.de>

Michael Heerdegen wrote:
> Óscar Fuentes writes:
> > Untested:
> > #!/usr/bin/emacs -Q --script
> 
> Thanks, but sadly, this obvious seeming thing doesn't do it.  In that
> case, neither -Q nor --script is respected.
> 
> I read somewhere that the "#!" thing doesn't allow to specify multiple
> arguments.

Correct.  It is an old interface with a lot of history.  It is most
often coded to accept exactly one argument.  Although different
systems have implemented it variously.

Here is the pertinent parts from the GNU/Linux man page documentation
on it.

  $ man 2 execve

       execve() executes the program pointed to by filename.  filename must be
       either a binary executable, or a script starting with  a  line  of  the
       form:

           #! interpreter [optional-arg]

       For details of the latter case, see "Interpreter scripts" below.
  ...
   Interpreter scripts
       An  interpreter  script  is  a  text  file  that has execute permission
       enabled and whose first line is of the form:

           #! interpreter [optional-arg]

       The interpreter must be a valid pathname for an executable which is not
       itself  a  script.   If  the filename argument of execve() specifies an
       interpreter script, then interpreter will be invoked with the following
       arguments:

           interpreter [optional-arg] filename arg...

       where arg...  is the series of words pointed to by the argv argument of
       execve(), starting at argv[1].

       For portable use, optional-arg should either be absent, or be specified
       as  a  single word (i.e., it should not contain white space); see NOTES
       below.
  ...

   Interpreter scripts
       A  maximum  line length of 127 characters is allowed for the first line
       in an interpreter scripts.

       The semantics of the optional-arg argument  of  an  interpreter  script
       vary across implementations.  On Linux, the entire string following the
       interpreter name is passed as a single argument to the interpreter, and
       this string can include white space.  However, behavior differs on some
       other systems.  Some systems use the first  white  space  to  terminate
       optional-arg.  On some systems, an interpreter script can have multiple
       arguments, and white spaces in optional-arg are  used  to  delimit  the
       arguments.

One of the best articles chronicling the details is Sven Mascheck's
site.

  http://www.in-ulm.de/~mascheck/various/shebang/

Bob



  reply	other threads:[~2015-05-26 20:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 14:44 --script and --quick Michael Heerdegen
2015-05-26 16:49 ` Óscar Fuentes
2015-05-26 17:05   ` Michael Heerdegen
2015-05-26 20:53     ` Bob Proulx [this message]
2015-05-27  3:48       ` Yuri Khan
2015-05-27  6:55         ` Gian Uberto Lauri
2015-05-27 11:51           ` Michael Heerdegen
2015-05-27 12:02             ` saint
2015-05-27 12:34               ` Michael Heerdegen
2015-05-27 12:39                 ` Gian Uberto Lauri
2015-05-27 12:52                   ` Michael Heerdegen
2015-05-28 14:27                     ` Michael Heerdegen
     [not found]         ` <mailman.3742.1432709757.904.help-gnu-emacs@gnu.org>
2015-05-27  7:18           ` Chris F.A. Johnson
2015-05-27 12:39             ` Gian Uberto Lauri
2015-05-28 12:35       ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150526142445521942652@bob.proulx.com \
    --to=bob@proulx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).