coreutils
[Top][All Lists]
Advanced

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

Re: env: add -S option (split string for shebang lines in scripts)


From: Pádraig Brady
Subject: Re: env: add -S option (split string for shebang lines in scripts)
Date: Sat, 5 May 2018 16:28:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/05/18 02:20, Assaf Gordon wrote:
> Hello,
> 
> Attached updated patch, two main improvements:
> 1. preserves empty arguments, e.g.
>         env -S echo "" bar
> 2. prints an error message on incorrect shebang usage:
> 
>       $ cat xxx
>       #!src/env -v -S cat -n
> 
>       $ ./xxx
>       src/env: possible incorrect usage of env in a script
>       Try 'src/env --help' for more information.
> 
> Item 2 is implemented in a separate patch (number 9) to ease review.
> 
> Of course the error message could be improved, as can the detection
> if the exact circumstances, but I'm not sure it's warranted.

I've attached some changes on top to indicate the existing error to users
plus additional info on how to address with the -S option.
I've also done this for the case of passing options to commands.
That results in:

  $ cat xxx
  #!src/env -i ls -l

  $ ./xxx
  src/env: invalid option -- ' '
  src/env: Use -[v]S to pass options in shebang lines
  Try 'src/env --help' for more information.

and

  $ cat xxx
  #!src/env ls -l

  $ ./xxx
  src/env: ‘ls -l’: No such file or directory
  src/env: Use -[v]S to pass options in shebang lines


> On 01/05/18 04:48 PM, Bernhard Voelker wrote:
>> On 05/01/2018 06:40 PM, Eric Blake wrote:
>>>
>>> #!/usr/bin/env -S -P /usr/bin:/opt/bin:${PATH} perl
>>>
> 
> "env -Ppath" is not implemented in this patch, but if we think it's
> worth while I'll add it in next patch.

It's best done in a separate patch.

thanks!
Pádraig

Attachment: env-S-tweaks-2.diff
Description: Text Data


reply via email to

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