Re: script relative shebang

From: Bernd Petrovitsch
Date: Wed Jun 01 2016 - 09:10:10 EST

Hi all!

On Wed, 2016-06-01 at 09:00 +0100, Boris wrote:
> Yes, I think this is too ugly:
> #!/usr/bin/gawk {exit system("/bin/sh -c 'exec \"$(dirname
> \"$0\")\"/subdir/catself \"$0\"' " FILENAME);}

The simplest solution for an application today is to provide a wrapper
script/program (to be placed in /usr/bin or /usr/local/bin) which knows
where to search for the applications executables - if adding some
directories to $PATH is not enough.

> Imagine you have that feature in your kernel would you rather use:
> #!{dirname}/subdir/catself

And what if "{dirname}" (or any other character sequence) happens to be
a valid pathname?

> You second advice involves changing root fs which is not desirable in
> copy-deployment apps (bring all the dependencies)
> This more about making kernel "user" friendly.

User-friendlyness is not the job of the kernel ...

[ Fullquote deleted as it's a bad habit ]

Bernd Petrovitsch Email : bernd@xxxxxxxxxxxxxxxxxxx