Inspect shell installers before running.
See what a curl | bash script does without running it.
curl -fsSL https://example.com/install.sh | shxray
- 61
if [ "$(id -u)" -ne 0 ]; then - 70
curl -fsSL "$URL" -o "$TMP/tool.tar.gz" - 71
sha256sum -c "$TMP/checksums.txt" - 72
gpg --verify "$TMP/tool.tar.gz.asc" "$TMP/tool.tar.gz" - 75
$SUDO install -m 755 "$TMP/tool" "$PREFIX/bin/tool" - 77
echo "export PATH=\"$PREFIX/bin:\$PATH\"" >> "$HOME/.bashrc" - 81
apt-get install -y ca-certificates - 87
curl -fsSL https://example.com/hook.sh | bash
Installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix), creates $PREFIX/share/tool, appends $HOME/.bashrc, and runs apt-get.
- 1. Downloads "$URL" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl. L70
- 2. Checks a checksum with sha256sum on $TMP/checksums.txt. L71
- 3. With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix). L75
- 4. Appends $HOME/.bashrc. L77
- 5. If ${SHXRAY_HOOK:-} = 1: pipes into bash: curl -fsSL https://example.com/hook.sh | bash. L87
Built for local inspection.
Reads from stdin or a file, parses the shell grammar, and lists what the script would do.
- Detected targets
- Normalizes amd64 and arm64 from uname, case, and $OSTYPE branches.
linux, darwin, freebsd / x86_64, aarch64 - Syntax-aware parser
- Parses real Bash and POSIX sh grammar with sh-syntax 0.8.7 (mvdan/sh), never regex scraping.
Bash (default), POSIX sh (--posix) - Runtime permissions
- Never runs the script and never requests network access.
deno run --allow-read --allow-env - Shared schema
- Terminal view and browser playground read the same AnalysisReport object.
AnalysisReport (version: 1) - Output language
- English and Japanese summaries, selected by flag or system locale.
--lang en | --lang ja
From raw shell to structured facts.
Every extracted claim keeps its source line so you can verify what triggered it.
OS="$(uname -s)"; ARCH="$(uname -m)" "platforms": { "operatingSystems": ["darwin", "freebsd", "linux"], "architectures": ["aarch64", "x86_64"] } curl -fsSL "$URL" -o "$TMP/tool.tar.gz" "downloads": [{ "tool": "curl", "references": ["$URL"], "line": 70 }] sha256sum -c "$TMP/checksums.txt" "integrity": [{ "tool": "sha256sum", "verifies": true, "line": 71 }] $SUDO install -m 755 "$TMP/tool" "$PREFIX/bin/tool" "privileges": [{ "kind": "sudo", "line": 75 }], "installs": [{ "destination": "$PREFIX/bin/tool" }] curl -fsSL https://example.com/hook.sh | bash "sideEffects": [{ "kind": "pipe-to-shell", "severity": "high", "line": 87 }] Try any script in your browser.
Runs locally inside a Web Worker with Wasm. Nothing leaves this tab.
Installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix), creates $PREFIX/share/tool, appends $HOME/.bashrc, and runs apt-get.
Downloads from example.com with curl and verifies integrity with gpg and sha256sum.
Checks whether it is root and may run commands with sudo.
Recognizes operating systems darwin, freebsd, and linux, and architectures aarch64 and x86_64.
- 1. Sets shell options (set -euo pipefail).
- 2. Sets $OS. Reads the kernel name with uname -s.
- 3. Sets $ARCH. Reads the machine hardware with uname -m.
- 4. Branches on $OS (Linux, Darwin, FreeBSD).
- 5. Branches on $ARCH (x86_64, amd64, aarch64, arm64).
- 6. Branches on $OSTYPE (linux-gnu, darwin*).
- 7. Parses CLI options (--prefix, --prefix=*, -y, --yes, -h, --help).
- 8. Creates a temporary directory ($TMP) with mktemp.
- 9. Downloads "$URL" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl.
- 10. Checks a checksum with sha256sum on $TMP/checksums.txt.
- 11. Verifies a signature with gpg on $TMP/tool.tar.gz.asc.
- 12. Extracts $TMP/tool.tar.gz with tar.
- 13. With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix).
- 14. Creates $PREFIX/share/tool.
- 15. Appends $HOME/.bashrc.
- 16. If $YES != 1:
- 17. Removes $TMP with rm -rf.
- 18. If ${SHXRAY_HOOK:-} = 1: pipes into bash: curl -fsSL https://example.com/hook.sh | bash.
Platforms
- OS:
darwin, freebsd, linux - Arch:
aarch64, x86_64
Install paths
-
install$PREFIX/bin/tool -
mkdir$PREFIX/share/tool -
append$HOME/.bashrc
Privileges
-
root-checkid -u -
sudo$SUDO install -m 755 "$TMP/tool" "$PREFIX/bin/tool"
Side effects
-
shell-rc(medium) $HOME/.bashrc -
package-manager(medium) apt-get update -
package-manager(medium) apt-get install -y ca-certificates -
rm-recursive(medium) rm -rf "$TMP" -
pipe-to-shell(high) curl -fsSL https://example.com/hook.sh | bash
{
"version": 1,
"locale": "en",
"tool": {
"name": "shxray",
"version": "0.1.0"
},
"source": {
"name": "installer.sh",
"bytes": 1513,
"lines": 88,
"shebang": "#!/usr/bin/env bash"
},
"parse": {
"ok": true,
"variant": "bash",
"error": null
},
"summary": {
"risk": "high",
"headline": "Pipes input into a shell; downloads remote files; writes install paths; uses privilege escalation; has other notable side effects.",
"sentences": [
"Installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix), creates $PREFIX/share/tool, appends $HOME/.bashrc, and runs apt-get.",
"Downloads from example.com with curl and verifies integrity with gpg and sha256sum.",
"Checks whether it is root and may run commands with sudo.",
"Recognizes operating systems darwin, freebsd, and linux, and architectures aarch64 and x86_64."
],
"counts": {
"options": 3,
"environment": 3,
"installs": 3,
"privileges": 2,
"downloads": 2,
"integrity": 2,
"sideEffects": 5
}
},
"flow": {
"entry": null,
"note": null,
"steps": [
{
"text": "Sets shell options (set -euo pipefail).",
"unresolved": null,
"line": 3,
"children": []
},
{
"text": "Sets $OS. Reads the kernel name with uname -s.",
"unresolved": null,
"line": 11,
"children": []
},
{
"text": "Sets $ARCH. Reads the machine hardware with uname -m.",
"unresolved": null,
"line": 12,
"children": []
},
{
"text": "Branches on $OS (Linux, Darwin, FreeBSD).",
"unresolved": null,
"line": 14,
"children": []
},
{
"text": "Branches on $ARCH (x86_64, amd64, aarch64, arm64).",
"unresolved": null,
"line": 24,
"children": []
},
{
"text": "Branches on $OSTYPE (linux-gnu, darwin*).",
"unresolved": null,
"line": 33,
"children": []
},
{
"text": "Parses CLI options (--prefix, --prefix=*, -y, --yes, -h, --help).",
"unresolved": null,
"line": 39,
"children": []
},
{
"text": "Creates a temporary directory ($TMP) with mktemp.",
"unresolved": null,
"line": 67,
"children": []
},
{
"text": "Downloads \"$URL\" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl.",
"unresolved": null,
"line": 70,
"children": []
},
{
"text": "Checks a checksum with sha256sum on $TMP/checksums.txt.",
"unresolved": null,
"line": 71,
"children": []
},
{
"text": "Verifies a signature with gpg on $TMP/tool.tar.gz.asc.",
"unresolved": null,
"line": 72,
"children": []
},
{
"text": "Extracts $TMP/tool.tar.gz with tar.",
"unresolved": null,
"line": 74,
"children": []
},
{
"text": "With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix).",
"unresolved": null,
"line": 75,
"children": []
},
{
"text": "Creates $PREFIX/share/tool.",
"unresolved": null,
"line": 76,
"children": []
},
{
"text": "Appends $HOME/.bashrc.",
"unresolved": null,
"line": 77,
"children": []
},
{
"text": "If $YES != 1:",
"unresolved": null,
"line": 79,
"children": [
{
"text": "Updates package indexes with apt-get.",
"unresolved": null,
"line": 80,
"children": []
},
{
"text": "Installs packages with apt-get: ca-certificates.",
"unresolved": null,
"line": 81,
"children": []
}
]
},
{
"text": "Removes $TMP with rm -rf.",
"unresolved": null,
"line": 84,
"children": []
},
{
"text": "If ${SHXRAY_HOOK:-} = 1: pipes into bash: curl -fsSL https://example.com/hook.sh | bash.",
"unresolved": null,
"line": 87,
"children": []
}
],
"detailed": [
{
"text": "Sets shell options (set -euo pipefail).",
"unresolved": null,
"line": 3,
"children": []
},
{
"text": "Sets $OS. Reads the kernel name with uname -s.",
"unresolved": null,
"line": 11,
"children": []
},
{
"text": "Sets $ARCH. Reads the machine hardware with uname -m.",
"unresolved": null,
"line": 12,
"children": []
},
{
"text": "Branches on $OS (Linux, Darwin, FreeBSD).",
"unresolved": "Which arm runs is not known statically.",
"line": 14,
"children": []
},
{
"text": "Branches on $ARCH (x86_64, amd64, aarch64, arm64).",
"unresolved": "Which arm runs is not known statically.",
"line": 24,
"children": []
},
{
"text": "Branches on $OSTYPE (linux-gnu, darwin*).",
"unresolved": "Which arm runs is not known statically.",
"line": 33,
"children": []
},
{
"text": "Loops while [ $# -gt 0 ].",
"unresolved": "How many iterations run is not known statically.",
"line": 38,
"children": [
{
"text": "Reads command-line options.",
"unresolved": "Which options are present is not known statically.",
"line": 39,
"children": []
}
]
},
{
"text": "Creates a temporary directory ($TMP) with mktemp.",
"unresolved": null,
"line": 67,
"children": []
},
{
"text": "Downloads \"$URL\" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl.",
"unresolved": null,
"line": 70,
"children": []
},
{
"text": "Checks a checksum with sha256sum on $TMP/checksums.txt.",
"unresolved": null,
"line": 71,
"children": []
},
{
"text": "Verifies a signature with gpg on $TMP/tool.tar.gz.asc.",
"unresolved": null,
"line": 72,
"children": []
},
{
"text": "Extracts $TMP/tool.tar.gz with tar.",
"unresolved": null,
"line": 74,
"children": []
},
{
"text": "With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix).",
"unresolved": null,
"line": 75,
"children": []
},
{
"text": "Creates $PREFIX/share/tool.",
"unresolved": null,
"line": 76,
"children": []
},
{
"text": "Appends $HOME/.bashrc.",
"unresolved": null,
"line": 77,
"children": []
},
{
"text": "Branches.",
"unresolved": "Which path runs is not known statically.",
"line": 79,
"children": [
{
"text": "When [ \"$YES\" -ne 1 ].",
"unresolved": null,
"line": null,
"children": [
{
"text": "Updates package indexes with apt-get.",
"unresolved": null,
"line": 80,
"children": []
},
{
"text": "Installs packages with apt-get: ca-certificates.",
"unresolved": null,
"line": 81,
"children": []
}
]
}
]
},
{
"text": "Removes $TMP with rm -rf.",
"unresolved": null,
"line": 84,
"children": []
},
{
"text": "Branches.",
"unresolved": "Which path runs is not known statically.",
"line": 86,
"children": [
{
"text": "When [ \"${SHXRAY_HOOK:-}\" = \"1\" ].",
"unresolved": null,
"line": null,
"children": [
{
"text": "Runs a pipeline: curl -fsSL https://example.com/hook.sh | bash.",
"unresolved": null,
"line": 87,
"children": []
}
]
}
]
}
]
},
"platforms": {
"operatingSystems": [
"darwin",
"freebsd",
"linux"
],
"architectures": [
"aarch64",
"x86_64"
],
"detections": [
{
"kind": "uname",
"category": "os",
"subject": "uname -s",
"values": [],
"evidence": {
"line": 11,
"column": 7,
"snippet": "OS=\"$(uname -s)\""
}
},
{
"kind": "uname",
"category": "arch",
"subject": "uname -m",
"values": [],
"evidence": {
"line": 12,
"column": 9,
"snippet": "ARCH=\"$(uname -m)\""
}
},
{
"kind": "case",
"category": "os",
"subject": "$OS",
"values": [
"Linux",
"Darwin",
"FreeBSD"
],
"evidence": {
"line": 14,
"column": 1,
"snippet": "case \"$OS\" in"
}
},
{
"kind": "case",
"category": "arch",
"subject": "$ARCH",
"values": [
"x86_64",
"amd64",
"aarch64",
"arm64"
],
"evidence": {
"line": 24,
"column": 1,
"snippet": "case \"$ARCH\" in"
}
},
{
"kind": "case",
"category": "os",
"subject": "$OSTYPE",
"values": [
"linux-gnu",
"darwin*"
],
"evidence": {
"line": 33,
"column": 1,
"snippet": "case \"$OSTYPE\" in"
}
}
]
},
"interface": {
"options": [
{
"flags": [
"--prefix"
],
"takesValue": true,
"evidence": {
"line": 40,
"column": 5,
"snippet": " --prefix)"
}
},
{
"flags": [
"-y",
"--yes"
],
"takesValue": false,
"evidence": {
"line": 47,
"column": 5,
"snippet": " -y | --yes)"
}
},
{
"flags": [
"-h",
"--help"
],
"takesValue": false,
"evidence": {
"line": 50,
"column": 5,
"snippet": " -h | --help)"
}
}
],
"environment": [
{
"name": "PREFIX",
"defaultValue": "/usr/local",
"origin": "parameter-default",
"evidence": {
"line": 7,
"column": 9,
"snippet": "PREFIX=\"${PREFIX:-/usr/local}\""
}
},
{
"name": "VERSION",
"defaultValue": "1.4.0",
"origin": "parameter-default",
"evidence": {
"line": 8,
"column": 10,
"snippet": "VERSION=\"${VERSION:-1.4.0}\""
}
},
{
"name": "SHXRAY_HOOK",
"defaultValue": "",
"origin": "parameter-default",
"evidence": {
"line": 86,
"column": 7,
"snippet": "if [ \"${SHXRAY_HOOK:-}\" = \"1\" ]; then"
}
}
]
},
"installs": [
{
"action": "install",
"destination": "$PREFIX/bin/tool",
"mode": "755",
"evidence": {
"line": 75,
"column": 1,
"snippet": "$SUDO install -m 755 \"$TMP/tool\" \"$PREFIX/bin/tool\""
},
"controls": [
{
"kind": "environment",
"name": "PREFIX",
"defaultValue": "/usr/local",
"defaultReason": null,
"envOverride": "PREFIX",
"assigns": null
},
{
"kind": "option",
"name": "--prefix",
"defaultValue": null,
"defaultReason": "unknown default",
"envOverride": null,
"assigns": "PREFIX"
}
]
},
{
"action": "mkdir",
"destination": "$PREFIX/share/tool",
"mode": null,
"evidence": {
"line": 76,
"column": 1,
"snippet": "mkdir -p \"$PREFIX/share/tool\""
},
"controls": [
{
"kind": "environment",
"name": "PREFIX",
"defaultValue": "/usr/local",
"defaultReason": null,
"envOverride": "PREFIX",
"assigns": null
},
{
"kind": "option",
"name": "--prefix",
"defaultValue": null,
"defaultReason": "unknown default",
"envOverride": null,
"assigns": "PREFIX"
}
]
},
{
"action": "append",
"destination": "$HOME/.bashrc",
"mode": null,
"evidence": {
"line": 77,
"column": 43,
"snippet": "echo \"export PATH=\\\"$PREFIX/bin:\\$PATH\\\"\" >> \"$HOME/.bashrc\""
},
"controls": []
}
],
"privileges": [
{
"kind": "root-check",
"detail": "id -u",
"evidence": {
"line": 61,
"column": 9,
"snippet": "if [ \"$(id -u)\" -ne 0 ]; then"
}
},
{
"kind": "sudo",
"detail": "$SUDO install -m 755 \"$TMP/tool\" \"$PREFIX/bin/tool\"",
"evidence": {
"line": 75,
"column": 1,
"snippet": "$SUDO install -m 755 \"$TMP/tool\" \"$PREFIX/bin/tool\""
}
}
],
"network": {
"downloads": [
{
"tool": "curl",
"urls": [
"https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz"
],
"references": [
"\"$URL\""
],
"evidence": {
"line": 70,
"column": 1,
"snippet": "curl -fsSL \"$URL\" -o \"$TMP/tool.tar.gz\""
}
},
{
"tool": "curl",
"urls": [
"https://example.com/hook.sh"
],
"references": [],
"evidence": {
"line": 87,
"column": 3,
"snippet": " curl -fsSL https://example.com/hook.sh | bash"
}
}
],
"integrity": [
{
"tool": "sha256sum",
"detail": "sha256sum -c \"$TMP/checksums.txt\"",
"verifies": true,
"evidence": {
"line": 71,
"column": 1,
"snippet": "sha256sum -c \"$TMP/checksums.txt\""
}
},
{
"tool": "gpg",
"detail": "gpg --verify \"$TMP/tool.tar.gz.asc\" \"$TMP/tool.tar.gz\"",
"verifies": true,
"evidence": {
"line": 72,
"column": 1,
"snippet": "gpg --verify \"$TMP/tool.tar.gz.asc\" \"$TMP/tool.tar.gz\""
}
}
]
},
"sideEffects": [
{
"kind": "shell-rc",
"severity": "medium",
"detail": "$HOME/.bashrc",
"evidence": {
"line": 77,
"column": 43,
"snippet": "echo \"export PATH=\\\"$PREFIX/bin:\\$PATH\\\"\" >> \"$HOME/.bashrc\""
}
},
{
"kind": "package-manager",
"severity": "medium",
"detail": "apt-get update",
"evidence": {
"line": 80,
"column": 3,
"snippet": " apt-get update"
}
},
{
"kind": "package-manager",
"severity": "medium",
"detail": "apt-get install -y ca-certificates",
"evidence": {
"line": 81,
"column": 3,
"snippet": " apt-get install -y ca-certificates"
}
},
{
"kind": "rm-recursive",
"severity": "medium",
"detail": "rm -rf \"$TMP\"",
"evidence": {
"line": 84,
"column": 1,
"snippet": "rm -rf \"$TMP\""
}
},
{
"kind": "pipe-to-shell",
"severity": "high",
"detail": "curl -fsSL https://example.com/hook.sh | bash",
"evidence": {
"line": 87,
"column": 3,
"snippet": " curl -fsSL https://example.com/hook.sh | bash"
}
}
],
"notes": [
"Static analysis only; the script was not executed.",
"Every branch and function body is inspected. Reachability is not computed.",
"Dynamic values are shown as written, including download URL arguments. Defaults are reported for literals and for ${VAR:-default} / ${VAR:=default}.",
"Install paths name the variable or option that controls them and the default written in the script. A default that is not written is unknown and is not guessed.",
"Log-file writes (a .log basename, a log directory, or a log variable name) are omitted from install paths.",
"Operating system and architecture names are normalized (amd64 -> x86_64, arm64 -> aarch64).",
"The flow follows literal function calls from the top level and lists every branch. It does not decide which branch runs."
]
} Summary
Installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix), creates $PREFIX/share/tool, appends $HOME/.bashrc, and runs apt-get.
Downloads from example.com with curl and verifies integrity with gpg and sha256sum.
Checks whether it is root and may run commands with sudo.
Recognizes operating systems darwin, freebsd, and linux, and architectures aarch64 and x86_64.
Flow
1. Sets shell options (set -euo pipefail). [L3]
2. Sets $OS. Reads the kernel name with uname -s. [L11]
3. Sets $ARCH. Reads the machine hardware with uname -m. [L12]
4. Branches on $OS (Linux, Darwin, FreeBSD). [L14]
5. Branches on $ARCH (x86_64, amd64, aarch64, arm64). [L24]
6. Branches on $OSTYPE (linux-gnu, darwin*). [L33]
7. Parses CLI options (--prefix, --prefix=*, -y, --yes, -h, --help). [L39]
8. Creates a temporary directory ($TMP) with mktemp. [L67]
9. Downloads "$URL" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl. [L70]
10. Checks a checksum with sha256sum on $TMP/checksums.txt. [L71]
11. Verifies a signature with gpg on $TMP/tool.tar.gz.asc. [L72]
12. Extracts $TMP/tool.tar.gz with tar. [L74]
13. With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix). [L75]
14. Creates $PREFIX/share/tool. [L76]
15. Appends $HOME/.bashrc. [L77]
16. If $YES != 1: [L79]
- Updates package indexes with apt-get. [L80]
- Installs packages with apt-get: ca-certificates. [L81]
17. Removes $TMP with rm -rf. [L84]
18. If ${SHXRAY_HOOK:-} = 1: pipes into bash: curl -fsSL https://example.com/hook.sh | bash. [L87] Automatic fetching from a URL is not supported. A remote server could serve different content to a browser than to curl (cloaking), or abuse the visitor's network and IP. Save the script locally first with curl -fsSL https://example.com/install.sh -o install.sh, then drop the file above or paste its contents.
Run shxray in your terminal.
Download a prebuilt single binary from GitHub Releases, no runtime required.
curl -sSfL https://raw.githubusercontent.com/Tiryoh/shxray/main/install.sh | sh Of course you can install it with curl too. Feel free to inspect install.sh in the workbench above before running it.
Prefer building from source with Deno 2.9+? See the GitHub README.
$ shxray tests/fixtures/installer.sh Summary
Installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix), creates $PREFIX/share/tool, appends $HOME/.bashrc, and runs apt-get.
Downloads from example.com with curl and verifies integrity with gpg and sha256sum.
Checks whether it is root and may run commands with sudo.
Recognizes operating systems darwin, freebsd, and linux, and architectures aarch64 and x86_64.
Flow
1. Sets shell options (set -euo pipefail). [L3]
2. Sets $OS. Reads the kernel name with uname -s. [L11]
3. Sets $ARCH. Reads the machine hardware with uname -m. [L12]
4. Branches on $OS (Linux, Darwin, FreeBSD). [L14]
5. Branches on $ARCH (x86_64, amd64, aarch64, arm64). [L24]
6. Branches on $OSTYPE (linux-gnu, darwin*). [L33]
7. Parses CLI options (--prefix, --prefix=*, -y, --yes, -h, --help). [L39]
8. Creates a temporary directory ($TMP) with mktemp. [L67]
9. Downloads "$URL" (= https://example.com/tool/releases/download/v${VERSION}/tool-${OS}-${ARCH}.tar.gz) with curl. [L70]
10. Checks a checksum with sha256sum on $TMP/checksums.txt. [L71]
11. Verifies a signature with gpg on $TMP/tool.tar.gz.asc. [L72]
12. Extracts $TMP/tool.tar.gz with tar. [L74]
13. With sudo, installs to $PREFIX/bin/tool (PREFIX defaults to /usr/local; override with PREFIX=... or --prefix). [L75]
14. Creates $PREFIX/share/tool. [L76]
15. Appends $HOME/.bashrc. [L77]
16. If $YES != 1: [L79]
- Updates package indexes with apt-get. [L80]
- Installs packages with apt-get: ca-certificates. [L81]
17. Removes $TMP with rm -rf. [L84]
18. If ${SHXRAY_HOOK:-} = 1: pipes into bash: curl -fsSL https://example.com/hook.sh | bash. [L87] CLI options and exit codes.
Reads stdin when no file path is given; prints help if stdin is a terminal.
| Flag | Behavior |
|---|---|
--json | Print the versioned AnalysisReport (version 1) as JSON. |
--verbose | Append the detailed branch tree and per-category facts. |
--lang <en|ja> | Choose English or Japanese prose output. |
--posix | Parse input as POSIX sh instead of Bash. |
--plain | Disable ANSI color (also automatic when stdout is piped). |
Exit codes: 0 analysis finished, 1 usage or I/O error, 2 syntax error (prints report with parse.ok false).
Scope and limits
- Static pass only
- Nothing runs, including command substitutions and heredoc payloads.
- Every branch shown
- Lists both sides of if and case without guessing which path runs.
- Unresolved variables
- Runtime values stay written as $URL unless assigned a single literal.
- No remote fetch
- Neither the CLI nor this site downloads URLs found inside a script.
Related tools
Different tools solve adjacent parts of shell safety. shxray focuses on local static inspection in place of bash.
Concept inspired by curl-bash-explain.