Index | Thread | Search

From:
Manuel Giraud <manuel@ledu-giraud.fr>
Subject:
Re: Support for /usr/bin/env -S (kind of)
To:
"Theo de Raadt" <deraadt@openbsd.org>
Cc:
tech@openbsd.org
Date:
Fri, 18 Jul 2025 18:23:45 +0200

Download raw body.

Thread
"Theo de Raadt" <deraadt@openbsd.org> writes:

> Manuel Giraud <manuel@ledu-giraud.fr> wrote:
>
>> Florian Obser <florian@openbsd.org> writes:
>> 
>> > It kind of misses a diff for the man page.
>> 
>> Yes I know but I wanted to try first if this could fly.
>
> It won't fly becuase we don't know what it does because you didn't
> document it.

Ok.  It is an option present in other implementations that permits to
have multiple command line options in a shebang script.  Here's what is
said in the linux manpage:

     -S, --split-string=S
              process and split S into separate arguments; used to pass
              multiple arguments on shebang lines

For example, one could make the following silly script:

#!/usr/bin/env -S cat -b -e
Hello World

The current env will fail because it will try to execvp the complete
string "cat -b -e":

env: cat -b -e: No such file or directory

I wanted to know if this would fly because here I choose to split the
string beforehand when argv[1] contain any separators.  I kept the "-S"
for compatibility with other implementations but, in fact, it does
nothing.
-- 
Manuel Giraud