|
|
|
|
|
by networked
187 days ago
|
|
You can use so-called "exec magic" instead of `env -S`.
Here is an explanation with Python examples: https://dbohdan.com/scripts-with-dependencies#exec-magic (disclosure: my site). In short: #! /bin/sh
"exec" "/usr/bin/env" "uv" "run" "--quiet" "--script" "$0" "$@"
# /// script
# dependencies = [
# "cowsay",
# ]
# ///
import cowsay
cowsay.cow("Hello, world!")
On systems that can't run uv, like NetBSD and OpenBSD, switch to pipx: #! /bin/sh
"exec" "/usr/bin/env" "pipx" "run" "$0" "$@"
# ...
|
|