



















good evening,
i have a question ... in that title is a command with env and bash ...
what does "-S" mean?
in man stays, that S is for separate ...
in my book it is not explained good ... does -S activate, that "-x" is a flag for env or "-x" is a flag for bash or "-x" is not a part of the name, that "bash -x" is not name of shell and "bash" without "-x" is name of shell?
what case above does -S mean?
it is not well explained in my book. can you answer to my questions please?
Last edited by lo7777799 (2026-06-07 19:29:33)
Why ask, test and learn:
$ cat test.sh
#!/bin/env bash -x
echo one
echo two
$ ./test.sh
env: ‘bash -x’: No such file or directory
env: use -[v]S to pass options in shebang lines
$ vim test.sh # edit to add -S flag
$ cat test.sh
#!/bin/env -S bash -x
echo one
echo two
$ ./test.sh
+ echo one
one
+ echo two
twoSo just as the man page says:
man env wrote:
-S, --split-string=S
process and split S into separate arguments; used to pass multiple arguments on shebang lines
Without the -S flag to 'env' the command it tries to execute is 'bash -x' which is not the name of an executable in the PATH. With the -S, it does just as the man page says and splits that into multiple arguments of 'bash' and '-x'.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。