3 ms·
You 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.
by buu700 5y ago
You 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