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

推荐订阅源

D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
IT之家
IT之家
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Help Net Security
J
Java Code Geeks
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research

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