Subject: Re: Changing exec's #! behavior
To: Andrew Brown <atatat@atatdot.net>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-kern
Date: 06/16/2000 07:48:26
    Date:        Thu, 15 Jun 2000 16:59:11 -0400
    From:        Andrew Brown <atatat@atatdot.net>
    Message-ID:  <20000615165911.B24770@noc.untraceable.net>

  | that's a neat use of this "function" but imho, it's not that much of a
  | feature and looks more like a bug.

I can assure you it is not a bug - it was planned that way.

Thinking about it since my last message, there is perhaps a
simple compromise that will suit most people - that is, a very
elementary quoting mechanism that is trivial to code.

That is, do what was suggested, and end the arg at the first
space in the "normal" case, and to allow an arg containing spaces,
simply precede it by a quote, which is stripped, then the arg is treated
literally.

So
	#!/usr/bin/awk 'NR >1 { print $1 + $2 }

would do the obvious thing, and

	#!/usr/bin/awk -f #script follows

would work as well.

That means that an arg that starts with a quote, which is intended to end
at the first space wouldn't be possible - but I think that's pretty unlikely.

  | i particularly like being able to:
  | 
  |     #!/bin/sh - # -*-Lisp-*-
  | 
  | and get lisp mode when i'm using emacs.

Ugh.

Even though I know less about emacs than almost anything on
the planet, it is true that that dead end hint line dosesn't
have to be first isn't it?  That is

	#! /bin/sh
	# -*-Lisp-*-

would work, wouldn't it.   If so, just use it, it is far more portable.

  | that was me...and i figured that the symlink loop protection mechanism
  | would be applicable in a similar way to this.

Unless it has changed in the past few years, the symlink protection
mechanism is a total crock.

kre