[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: |
Eric Blake |
Subject: |
Re: env: add -S option (split string for shebang lines in scripts) |
Date: |
Fri, 27 Apr 2018 13:57:38 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/26/2018 02:17 AM, Assaf Gordon wrote:
> Hello,
>
> Attached an updated patch, hopefully addressing all the issues below.
> Initial documentation also included (seperated into several commits to ease
> review).
>
> A renderd html page is available here:
> http://housegordon.org/files//tmp/env-invocation.html
This is missing support for -P, which is one of the essential features
of FreeBSD env, per their man page:
https://www.freebsd.org/cgi/man.cgi?query=env
Probably the most common use of env is to find the correct interpreter
for a script, when the interpreter may be in different directories on
different systems. The following example will find the `perl' inter-
preter by searching through the directories specified by PATH.
#!/usr/bin/env perl
One limitation of that example is that it assumes the user's value for
PATH is set to a value which will find the interpreter you want to exe-
cute. The -P option can be used to make sure a specific list of
directo-
ries is used in the search for utility. Note that the -S option is
also
required for this example to work correctly.
#!/usr/bin/env -S -P/usr/local/bin:/usr/bin perl
The above finds `perl' only if it is in /usr/local/bin or /usr/bin.
That
could be combined with the present value of PATH, to provide more
flexi-
bility. Note that spaces are not required between the -S and -P
options:
#!/usr/bin/env -S-P/usr/local/bin:/usr/bin:${PATH} perl
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: env: add -S option (split string for shebang lines in scripts), (continued)
- Re: env: add -S option (split string for shebang lines in scripts), Pádraig Brady, 2018/04/23
- Re: env: add -S option (split string for shebang lines in scripts), Assaf Gordon, 2018/04/24
- Re: env: add -S option (split string for shebang lines in scripts), Assaf Gordon, 2018/04/26
- Re: env: add -S option (split string for shebang lines in scripts), Pádraig Brady, 2018/04/27
- Re: env: add -S option (split string for shebang lines in scripts), Bernhard Voelker, 2018/04/27
- Re: env: add -S option (split string for shebang lines in scripts), Eric Blake, 2018/04/27
- Re: env: add -S option (split string for shebang lines in scripts), Eric Blake, 2018/04/27
- Re: env: add -S option (split string for shebang lines in scripts),
Eric Blake <=
- Re: env: add -S option (split string for shebang lines in scripts), Eric Blake, 2018/04/27
- Re: env: add -S option (split string for shebang lines in scripts), Assaf Gordon, 2018/04/27