Questions tagged [shebang]
Use the tag /shebang if your question is about `#!`-string at the beginning of a script
136 questions
0 votes
0 answers
43 views
User can't execute a shell script based on shebang but ok when interpreter directly invoked [duplicate]
Context I have a system user caddy and a shell script placed under /run/caddy/caddy-cert-obtained-wrapper.sh. /run and /run/caddy are owned by root:root with permissions 0755. caddy-cert-obtained-...
-3 votes
2 answers
260 views
Is Bourne shell shebang #!/bin/sh expecting BASH POSIX-correct? [closed]
I've recently been playing with the legacy Bourne Shell from the GitHub repo heirloom-sh. It's installed at /usr/local/bin/sh with no symlinks. One script is invoking it via #!/bin/env sh. I'm running ...
3 votes
2 answers
2k views
bash shebang on macOS
On macOS, #!/bin/bash means a script will use the system bash, which is very dated (3.2, 2006 year) and (for myself, at least) mostly useless. Then you can install modern bash using Homebrew or ...
14 votes
1 answer
2k views
Shebang can reference a script in Linux
I've always heard that the target of a shebang line (e.g. #!/bin/bash) must be a binary executable, not a script. And this is still true for many OSes (e.g. MacOS). But I was surprised to see that ...
0 votes
0 answers
84 views
Unable to mount from a script using shebang (kernel hardening related ?)
I stumbled across a really weird issue with mount. I'm unable to make sense out of it. For some context, I wrote a Python script that aims to automount hot-pluggable USB devices, but this is not ...
1 vote
0 answers
159 views
How does the system decide which shell runs a script without a shebang line? [duplicate]
I have this "script" on my Arch Linux system: $ cat ~/scripts/foo.sh ps -hp $$ It will simply run ps on its own PID. But the script has no shebang line. I was expecting that in the absence ...
4 votes
1 answer
1k views
Why don't we use #!command for the shebang line?
#!python3 print("Hello") I find that this code works fine in my terminal. But everyone does #!/path/to/file or #!/usr/bin/env command. Is there any reason to avoid using #!command in ...
2 votes
2 answers
440 views
Do executable shebang scripts always require LF line endings?
On Stack Overflow a comment to Can PowerShell Core handle ps1 files with CRLF line endings in Linux environments? asserted that executable files that use a shebang must use only the LF line ending, ...