3 ms·
Agreed. I liked fish last time I tried it (probably over a decade ago), but bash scripting is what I'm familiar with and it's just so convenient in day-to-day u
by buu700 5y ago
Agreed. I liked fish last time I tried it (probably over a decade ago), but bash scripting is what I'm familiar with and it's just so convenient in day-to-day usage to be able to throw out one-liners for mundane things and then have them permanently searchable in my history.
- yourad_io 5y agoI thought Ctrl+R was cool but in fish you are always in search mode! Start typing any part of your previous command and hit up arrow!
- aembleton 5y agoHave you just tried the following to run your bash one liners in fish? bash -c 'echo "hello"' Replacing echo "hello" with your script.
- buu700 5y agoYou could do that, but it would be pretty inconvenient in general, and more so when using quotes within the script. There would also be no autocomplete.
- deleted 5y ago[deleted]
- pxc 5y agoSo 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-bindings.fish 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 ⋊> ~ 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 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
- kaba0 5y agoBash scripting and convenient is strange in the same sentence. Bash is an abomination that should not even exist. Like, even thinking about a line of bash code will have 3 bugs.