HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
bouk
babelfish
Go2020–2023
bouk / babelfish

babelfish

Translate bash scripts to fish

3Distinct people
5Mentions
0Explicit recommenders
259GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Translate bash scripts to fish

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year5 dated mentions

Observed mentions: 2020-06-14 17:14:04 UTC to 2023-08-26 16:02:39 UTC.

0122020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC110
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC202
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

What Hacker News says

5 sources
> naively, I assumed that installing it from the official channel would do the job. Years ago, I submitted a PR that added this exact behavior. But it depended on interpolating a Nix-internal variable into a config file in the Fish package which at the time was undocumented (@NIX_STATE_DIR@) and upon the layout of profiles within it, so there was concern that it might break on future Nix releases. There were a few other issues, too, and at the time I don't think there was a great way to add tests, either. (That's important because if you screw this up, you can break login for Nix users— I know because I did it once, and that was awful.) Anyway, I felt discouraged and didn't know where to go with it next, so I got lazy and dropped the PR. At any rate, I don't think your expectation there was unreasonable. I think that would be a good and s
Read the rest
ensible UX, and your intuition was reasonable. > After yesterday's post about Nix I tried to install it on my Arch+fish machine. I couldn't. So the problem is this: the official Nix installer leverages an initialization script, to be sourced at shell init time, which is written in POSIX shell. Fish can't just source it because it's not compatible with POSIX shell. > I then searched the Internet and found a very "creative" workaround for Arch users that didn't work either. Arch users shouldn't need anything special here. You can use fenv¹ to source it, you can translate it to bash using babelfish, or you can exec into fish after running bash to log in (make sure to set $SHELL after if you choose that option). Just make sure you do it as early as possible if you want to use things installed by Nix in your other Fish config snippets. I think Home Manager will also take care of this for you. (The other module systems, Nix-Darwin and NixOS, both do.) If you wanna do it like NixOS does, you can install Fish via Nix and then create your own preinit environment script in /etc/fish. This has the advantage of setting up your Nix environment variables before any other config is sourced. You can take a look at it here, which also explains some of the Fish initialization process: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/p... and here's where the hooks go in the Fish package, where the comments describe the Fish initialization process in detail as well as why things are done this way on NixOS: https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/fis... — 1: https://github.com/oh-my-fish/plugin-foreign-env 2: https://github.com/bouk/babelfish
In Our Roadmap for Nix
So I don't think this quite solves the issue you describe, which is that if your history was full of convenient Fish one-liners, you wouldn't be able to reuse them in your scripts, because for scripting you prefer Bash. But: 1. I have CTRL+R bound to fuzzy reverse history search via fzf in my Fish config. It works great. It's fast, and it's way better than the built-in Bash reverse history search imo, even though it works basically the same way (it should feel very familiar). fzf itself comes with the keybindings, so you don't have to sort them out yourself; you can just source 'em: https://github.com/junegunn/fzf/blob/master/shell/key-bindin... 2. For one-off one liners you see in GitHub repos or something, if you really want tab completion and syntax highlighting and whatever, you can just use `exec` twice: ⋊> ~ echo $HELLO
Read the rest
⋊> ~ exec bash ~ $ export HELLO=hello ~ $ exec fish Welcome to fish, the friendly interactive shell ⋊> ~ echo $HELLO hello 3. If you want to import your handy one-liners from your existing `.bash_history`, you could try using babelfish to automatically translate them, then import them into your Fish history: https://github.com/bouk/babelfish It may not work right for some of them, but it's worked on the scripts I've tried. You might also be able to bind a key that translates whatever command there is on the prompt into Fish. It seems to handle the basics well, including subshells with redirection/process substitution, e.g.: ~ $ cat <(echo hi) hi ~ $ history | sed -E 's/^[[:space:]]+[[:digit:]]+[[:space:]]+//g' | grep -E '^cat' | tail -n1 | babelfish cat (echo hi | psub) ~ $ fish Welcome to fish, the friendly interactive shell ⋊> ~ cat (echo hi | psub) hi ⋊> ~ exit ~ $ Babelfish is pretty fast. Maybe you could create a Fish keybind that searches through your bash history, only it's translated to Fish via babelfish? Then at least you could keep your existing history in a way :D
In The fish shell is amazing

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.