You are not logged in.
Pages: 1
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)
Offline
Offline
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:
-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
Offline
Certain professions don't allow for trying/testing/whatever you might call it.
Sure enough you could always try but the fact that you can try/test/whatever *simply* increases margin for error.
Offline
Ah, right, sure. But shell scripting is not one of those professions. Experimenting with scripting is the best way to learn. So I'm really not sure what you're on about unless you are just trying to stir shit up.
Last edited by Trilby (Yesterday 20:36:18)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1