]> git.ipfire.org Git - thirdparty/coreutils.git/commit
env: add -S/--split-string option
authorAssaf Gordon <assafgordon@gmail.com>
Sat, 21 Apr 2018 02:58:28 +0000 (20:58 -0600)
committerPádraig Brady <P@draigBrady.com>
Thu, 21 Jun 2018 04:15:31 +0000 (21:15 -0700)
commit668306ed86c8c79b0af0db8b9c882654ebb66db2
treefb24c853476781ed6975033b58478280b897178e
parenta0118a71bb16f9b3f0e8d0cbfce4f78fc630fb19
env: add -S/--split-string option

Adopted from FreeBSD's env(1), useful for specifing multiple
parameters on a shebang (#!) script line, e.g:

   #!/usr/bin/env -S perl -w -T

Discussed in https://lists.gnu.org/r/coreutils/2018-04/msg00011.html

* src/env.c (valid_escape_sequence,escape_char,scan_varname,
  extract_varname,validate_split_str,build_argv,
  parse_split_string): New functions.
  (main): Process new option and call parse_split_string.
  (usage): Mention new option.
* tests/misc/env-S.pl: Test new option from the command line.
* tests/misc/env-S-script.sh: Test new option from shebang scripts.
* tests/local.mk (all_tests): Add new tests.
* man/env.x (OPTIONS): Show a brief example of -S usage and point to
the full documentation for more information.
* doc/coreutils.texi (env invocation): Detail usage of -S/--split-string
option.
* NEWS: Mention new option.
AUTHORS
NEWS
doc/coreutils.texi
man/env.x
src/env.c
tests/local.mk
tests/misc/env-S-script.sh [new file with mode: 0755]
tests/misc/env-S.pl [new file with mode: 0755]