Skip to content
Logo

Shebang commands

Set interpreter = "shebang" and point script at an executable with a #! line (sh, perl, awk, node, python, …). Prefer shebang when you need the real filesystem, network, or a tool on PATH.

Stdin is the command input. Stdout is the result text (subject to output routing).

Environment

VariableMeaning
RECUR_SELECTED_TEXTSelection
RECUR_CURRENT_LINECurrent line
RECUR_LINE_NUMBER1-based line
RECUR_COLUMN_NUMBERColumn
RECUR_CURRENT_WORDWord at cursor
RECUR_FILEPATHAbsolute path
RECUR_FILENAMEBasename
RECUR_DIRECTORYFile directory
RECUR_PROJECT_DIRECTORYProject root
RECUR_SCOPELanguage / scope hint
RECUR_TAB_SIZETab size
RECUR_SOFT_TABSSoft tabs flag
RECUR_CLIPBOARDClipboard text
RECUR_BUNDLE_SUPPORTBundle support path
RECUR_INPUT_<NAME>Extra named inputs

Timeouts

Shebang commands run in a process group with a 30s default deadline (timeoutMs on the run context can lower it; willSave uses ≤12s per command). There is no cancel button; when the deadline hits, the process group is killed.

Exit codes

ExitBehavior
0Apply the routed output
non-zeroToast stderr; discard buffer-mutating routings (replace* / insert* / newDocument)

showAsToast / showAsTooltip / copyToClipboard may still fire when stdout is non-empty.

Tools that use exit 1 as a normal outcome (e.g. diff) must normalize to 0 before returning. See the shipped bundles/Diff/bin/diff-clipboard.sh.

Example

[[command]]
id = "my.pack.prefix-lines"
name = "Prefix Lines"
category = "MyPack"
order = 20
input = "selection"
fallbackInput = "document"
output = "replaceInput"
triggers = ["palette"]
interpreter = "shebang"
script = "bin/prefix-lines.sh"