惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
G
Google Developers Blog
M
MIT News - Artificial intelligence
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
B
Blog
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

Arch Linux Forums

Avidemux crashes without strace / Applications & Desktop Environments how to apply patches with non-linux linends / Newbie Corner Replicating CachyOS on vanilla Arch (or at least getting close) / Arch Discussion What's arch linux GUI package manager ? / Newbie Corner Hibernation failing due to insufficient memory / System Administration profiledef.sh editting question / Installation trying to script kde plasma wallpaper settings / Programming & Scripting Looking for new Audacious package maintainer / Creating & Modifying Packages issues installing arch with LUKS2 encryption / Newbie Corner QEMU PXE booting does not work with OVMF.4m.fd / Applications & Desktop Environments Wired lan regular disconnect / Newbie Corner Need Help setting up ARCH in my G16 G634JZR iwlwifi started failing consistently, trying to determine root cause Windows randomly jumping between monitors after GNOME 50 update No display via DP or HDMI after boot. / Kernel & Hardware how to change acpi platform_profile? / Newbie Corner Linux denied all kernel modules which not loaded right now Use iPhone as Webcam for Arch Linux Video Output Failure on nvidia-580xx-dkms on TTY --> Desktop switch (Page 2) / Kernel & Hardware I was going to rant ..WINE32 Sabotage compliments of Arvind Krishna / Arch Discussion [SOLVED] LUKS drive auto unlocked by TPM when expected not to / Networking, Server, and Protection Hibernate/suspend from X = dark panel; from TTY = works (ASUS G14, hyb (Page 2) / Laptop Issues Headphone jack noise/buzz / Newbie Corner segmentation fault in cc1plus when building CLK / AUR Issues, Discussion & PKGBUILD Requests Console alternative to meld / GNU/Linux Discussion Problem with paru git clone / Newbie Corner XKB questions / Applications & Desktop Environments gnome-keyring-daemon is not working correctly / Applications & Desktop Environments [SOLVED] Steam opens and immediately closes constantly / Newbie Corner Firefox rounded edges on Sway / Applications & Desktop Environments
#!/usr/bin/env -S bash -x / Programming & Scripting
Trilby · 2026-06-15 · via Arch Linux Forums

#1 2026-06-07 19:29:17

lo7777799
Member
Registered: 2023-07-25
Posts: 87

#!/usr/bin/env -S bash -x

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)

#2 2026-06-07 19:43:52

jonno2002
Member
Registered: 2016-11-21
Posts: 868

Re: #!/usr/bin/env -S bash -x

#3 Today 12:42:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,458
Website

Re: #!/usr/bin/env -S bash -x

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
two

So 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