Hacker News new | ask | show | jobs
by darrenf 1547 days ago
~30 year bash/sh user here (glossing over the regrettable, mercifully brief dalliances with csh and ksh). I can’t claim to be long suffering, because I (still) enjoy using bash.

In December just gone I gave up on macOS after 17 years and switched to Linux. Thought I’d take the opportunity to try a new shell and went for fish (though I still use bash on certain remote hosts for a variety of reasons).

autocomplete and colours/highlighting are more than enough to keep me using it. I really enjoy them. But…

I don’t yet love how history works. Four months in, I still can’t get used to not having ctrl-r.

I miss the symmetry of `do … done` in loop syntax, finding `for … end` jarring.

The lack of !! really grates sometimes. I was going to say I miss `^x^y` last command modification, but actually I can’t recall trying it since switching.

`VAR=x cmd …` doesn’t seem to work quite how I expect. I have an alias/function to perform SSO login to AWS, which expands to `BROWSER=otherfunc aws sso login` - otherfunc itself expanding to `firefox -P workprofile`. This stubbornly opens a Firefox tab in some random window, regardless of profile - despite otherfunc on its own always working. I did not, IIRC, have this trouble with bash.

2 comments

> I don’t yet love how history works. Four months in, I still can’t get used to not having ctrl-r.

I think it's worth getting used to but there are plugins like fzf that implement ctrl-r

> `BROWSER=otherfunc aws sso login`

Aliases/functions are generally not visible in child processes. I guess it worked if the "aws" tool invoked BROWSER via a bash process that either sources aliases from a bashrc, or reads exported functions ("export -f otherfunc"). It would work for fish too if "aws" invoked BROWSER via fish (though fish doesn't need exporting, since functions are also loaded in non-interactive shells).

I recommend that you make otherfunc a script, then it will work everywhere (also with arbitrary wrappers like strace, gdb).

McFly works on Fish and re-adds your ctrl-R back, except makes it much more powerful: https://github.com/cantino/mcfly