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
