Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I love fish shell, I love the autocomplete, but I've been forced to switch back to bash lately, because fish syntax is just different enough from bash-isms to break too much scripts / tools / commands.

I know I could just invoke bash, but prefixing commands with "bash -c '" is tiring and papercuts are why I switched to fish in the first place. I wish bash had a sane auto-complete prediction like fish.



Fish doesn’t break scripts, they use whatever interpreter you specified when you wrote them.

I use fish interactively and write very simple scripts in bash and the more complex in Python.


Maybe op is sourcing said scripts instead of executing them?


You might want to try (or revisit) zsh, which is closer to bash but has some nice features. Use oh-my-zsh for some nice theming and extra features.

https://github.com/robbyrussell/oh-my-zsh


There's some initial pain in retrofitting your Bash startup to work under fish, but after that it's worth it. For example I had to search for how to use ssh-agent with fish, and now it works great: https://github.com/st3fan/dotfiles/blob/master/fish/ssh.fish

You need to learn a few idioms like: replace $[1+1] with (math "1+1"); replace

> for f in $(ls); do echo $f; done

with

> for f in (ls); echo $f; end

I should start a Rosetta Stone of Bashisms to Fishisms - I'd be interested if anyone has got Android Open Source build environment / lunch working.


Your scripts should begin with #!/bin/bash or similar so you can execute them from anywhere. Are there bash built-in commands or functions that you need while in fish?


FWIW I'm working on a bash-compatible shell:

http://www.oilshell.org/blog/

If nothing else, I have thousands of lines of my own shell scripts that I don't care to move to a different shell syntax that's not obviously better :)

There are lots of posts on the blog about it, but here is an example:

"OSH Runs Real Shell Programs" - http://www.oilshell.org/blog/2017/07/02.html

Another comment: https://news.ycombinator.com/item?id=15916470

However one thing is that it's not yet a good interactive shell. It's mainly treating bash as a programming language. However I think that is a good foundation for an interactive shell. Some details here:

https://www.reddit.com/r/commandline/comments/7c3f9f/osh_02_...


You can get it much of the way there by tweaking `~/.inputrc`

"\e[A": history-search-backward # Up key

"\e[B": history-search-forward # Down key.

Allows you to get press up while you have `ssh 10.2` in the terminal to cycle through ips matching, etc. It won't display like in fish before pressing it, but I find that's a reasonable tradeoff.


I've had success with bass[1]. Typically, I use it when some kind of tool requires sourcing bash scripts.

[1] https://github.com/edc/bass


+1 I gave it a try a couple years ago and I remember having issues with RVM (Ruby Version Manager). Hope is fixed though


It is fixed, RVM supports Fish now - https://rvm.io/integration/fish


pbpaste | bash -c? :D


bash uses readline to handle user input and in readline the completion function is a parameter. Could a more clever completion function be substituted to get the same behaviour with bash?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: