File tree Expand file tree Collapse file tree 2 files changed +24
-13
lines changed
Expand file tree Collapse file tree 2 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,30 @@ jbang hello.java your-args
95953.3.0 and newer versions things just works.
9696====
9797
98+ == Self-bootstrapping Scripts
99+
100+ It is possible to enhance the shebang to make self-bootstrapping JBang scripts.
101+
102+ There is a bootstrap script available in the JBang repository:
103+
104+ [source,bash]
105+ ----
106+ jbang bootstrap@jbangdev hello.java
107+ ----
108+
109+ This will add or update the shebang header to something like:
110+
111+ [source,bash]
112+ ----
113+ ///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $?
114+ ----
115+
116+ Which is a mouthful, but basically translate to:
117+
118+ 1. Check if jbang is in PATH
119+ 2. If not, install JBang using the default install script and set PATH temporarily to include the newly installed jbang
120+ 3. Execute freshly installed jbang with the same arguments as the script
121+
98122== Java Version Management
99123
100124JBang automatically handles Java versions for you:
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments