Skip to content
kidonngPublic

About

๐Ÿ› Bash to fish transpiler

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

154 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ› Bait: Almost Idiomatic Transpiler

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

Install

  • GitHub

    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

    nix profile install github:kidonng/bait

Usage

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.fish

Advanced

Load shims to directly source bash scripts:

bait shim source > ~/.config/fish/functions/source.fish
bait shim . > ~/.config/fish/functions/..fish

Load all shims:

for shim in (bait shim list)
    bait shim $shim > ~/.config/fish/functions/$shim.fish
end

Bind a shortcut to paste bash snippet into fish:

bind ctrl-b 'commandline --insert (fish_clipboard_paste | bait --no-shims)'

Docs

About

๐Ÿ› Bash to fish transpiler

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages