|
Bait is a Bash to fish transpiler. This project is based on mvdan/sh, similar to the existing babelfish project. However, bait translates bash much better, both in quality and supported features. Bait leverages modern fish features to produce clean, idiomatic output. Most common Bash snippets translate with only minimal changes. Bait can already translate nvm and many prominent installers, allowing them to run natively in fish. |
Screen.Recording.2026-08-30.at.6.26.21.AM.mov |
Note
- Try the live demo!
- Want the reverse (fish โ Bash)? Checkout Hook!
-
mkdir -p ~/.local/bin && curl --location "https://github.com/kidonng/bait/releases/latest/download/bait_$(uname -s)_$(uname -m | sed 's/aarch64/arm64/').tar.gz" | tar -xz -C ~/.local/bin bait
-
nix profile install github:kidonng/bait
Warning
Bait translation may produce unexpected result. Check output before serious usage.
# Translate from stdin
echo 'VAR=hello; echo "$VAR"' | bait
# Translate to stdout
bait install.sh > install.fish
# Source your favorite script
bait < script.sh | source
curl script.sh | bait | source
# Suppress warnings on stderr (or BAIT_QUIET=1)
bait --quiet install.sh > install.fish
# Prevent shim injection (or BAIT_NO_SHIMS=1)
bait --no-shims install.sh > install.fishLoad shims to directly source bash scripts:
bait shim source > ~/.config/fish/functions/source.fish
bait shim . > ~/.config/fish/functions/..fishLoad all shims:
for shim in (bait shim list)
bait shim $shim > ~/.config/fish/functions/$shim.fish
endBind a shortcut to paste bash snippet into fish:
bind ctrl-b 'commandline --insert (fish_clipboard_paste | bait --no-shims)'- Compatibility Guide: reference for (un)supported features
- Developer Guide: architectural principles & developer workflows