help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --script and --quick


From: Bob Proulx
Subject: Re: --script and --quick
Date: Tue, 26 May 2015 14:53:47 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]