News for hackers. Stuff that matters.
Re:Fish: A user-friendly command line shell for macOS, Linux... by burke on Tuesday December 12, 2017 @08:52PM (#15911352)
I used fish twice for about a year each time, but I keep switching back to zsh, because:

* The main things I like about fish are predictive history completion and syntax highlighting, both of which work about the same with a pair of zsh plugins;

* The syntax occupies what is, for me, an awkward middle ground: it's a bit better than POSIX syntax if POSIX shells didn't exist, but not enough better that I care to juggle the two syntaxes;

* I don't like that fish tries to be "helpful" in certain cases such as lying to you about the delimeter actually used by $PATH.

I have a couple of specific gripes about the syntax, which aren't really inherent issues so much as unimplemented features.

I think if I was going to deviate from a POSIX shell, the alternative would have to be more better than fish to be worth it.

Re:Fish: A user-friendly command line shell for macOS, Linux... by spinningarrow on Wednesday December 13, 2017 @01:42AM (#15912496)
I started with bash, moved on to zsh and finally settled on fish. Besides fish being super user-friendly out of the box, I couldn’t find a zsh plugin that emulated its history search abilities.
Re:Fish: A user-friendly command line shell for macOS, Linux... by sertorius on Wednesday December 13, 2017 @08:26AM (#15914030)
I use the following lines in my .bashrc to search the history based on a half-typed command (taken from https://stackoverflow.com/questions/1030182/how-do-i-change-...):

    if [[ $- == *i* ]]
    then
        bind '"\e[A": history-search-backward'
        bind '"\e[B": history-search-forward'
    fi
Re:Fish: A user-friendly command line shell for macOS, Linux... by spinningarrow on Wednesday December 13, 2017 @11:44AM (#15915359)
There are two history search features in fish that I really like: One is searching for a half typed command as above, but the other one that I haven’t found elsewhere is completing words from other commands. For example, I can type ‘touch something’ and later on do ‘cat some’ and then press option+up and fish will complete it to ‘something’.
Re:Fish: A user-friendly command line shell for macOS, Linux... by figgis on Thursday December 14, 2017 @12:35PM (#15924305)
After using ZSH I have that first feature and love it. I try to keep as much of my history as possible and it's amazing how much time you can save that way. Does that second feature not clutter up that history though?
Re:Fish: A user-friendly command line shell for macOS, Linux... by tomaskafka on Monday December 18, 2017 @06:11AM (#15950840)
> * The syntax occupies what is, for me, an awkward middle ground: it's a bit better than POSIX syntax if POSIX shells didn't exist, but not enough better that I care to juggle the two syntaxes;

This. It's an awesome shell, but I couldn't set is as a default because my already done shellscripts and aliases would stop working. And I also can't set it on server, because then a deployment tool logs in, and expects bash.

And if it isn't default, I might not bother, I'd forget to run it manually most of the time.

(The worst offender is replacing && with 'and' - why not at least enable both and preserve compatibility?)

Re:Fish: A user-friendly command line shell for macOS, Linux... by eaceaser on Wednesday December 13, 2017 @12:50AM (#15912326)
What are the ZSH plugins that you use, out of curiosity?
Re:Fish: A user-friendly command line shell for macOS, Linux... by burke on Wednesday December 13, 2017 @01:19AM (#15912426)
Re:Fish: A user-friendly command line shell for macOS, Linux... by y4mi on Wednesday December 13, 2017 @03:54AM (#15912987)
you might be interested in using zsh-histdb[1] as well.

really, really cool

[1] https://github.com/larkery/zsh-histdb

Re:Fish: A user-friendly command line shell for macOS, Linux... by dewey on Wednesday December 13, 2017 @08:01AM (#15913919)
Thanks for that, I was searching for something like that for a while!
Re:Fish: A user-friendly command line shell for macOS, Linux... by ufo on Wednesday December 13, 2017 @09:32AM (#15914408)
Is it possible to configure zsh to have sane variable expansion like fish does? One of my favourite parts of fish is that I don't need to quote every variable I use out of a paranoid fear that they might contain spaces.
Re:Fish: A user-friendly command line shell for macOS, Linux... by faho on Wednesday December 13, 2017 @11:42AM (#15915353)
Apparently zsh actually does something similar by default.

See http://zsh.sourceforge.net/FAQ/zshfaq03.html.

Re:Fish: A user-friendly command line shell for macOS, Linux... by davemp on Tuesday December 12, 2017 @11:33PM (#15912045)
Out of curiosity, what use case do you have that makes a POSIX shell a big deal?

I’ve never had issues as a somewhat heavy user.

Re:Fish: A user-friendly command line shell for macOS, Linux... by burke on Wednesday December 13, 2017 @01:17AM (#15912420)
There's nothing major. I maintain a set of POSIX and fish scripts as part of my job and, given that I have to know both relatively well, I find I end up preferring the on-average-slightly-more-terse POSIX syntax.

One thing that can be particularly annoying is that it seems to be impossible in fish to evaluate a command in a subshell and embed its output into a string without assigning it to a variable first.

ARGV handling is a little weird too. I understand the impulse to get rid of $1, $2, $3, $*, $@, $#, etc., but it ends up just requiring different gymnastics, like writing `set -e argv[1]` instead of `shift.

Re:Fish: A user-friendly command line shell for macOS, Linux... by zeveb on Wednesday December 13, 2017 @11:01AM (#15915051)
> Out of curiosity, what use case do you have that makes a POSIX shell a big deal?

Running on a POSIX system, there are decades' worth of shell snippets out there which don't work with fish, but do with sh, ksh, bash & zsh.

Fish is just gratuitously incompatible. Having fish-users on a team is a pain, because they'll write everything in fish and either not bother producing sh equivalents, or produce insufficiently-tested sh equivalents. It's just a lot of pain and bother, and what's the benefit? Zsh does everything fish does and more, so why not just use it?

Edit: I just wish that the original fish developers had chosen to implement all their cool features and be sh-compatible, or at the very least had exercised some wisdom in where they chose to break compatibility. Instead, it very much feels like a 22-year-old's project: full of ideas, some good & some bad, and needlessly without respect for the past. I've no problem with rejecting the past when the past is broken (and sh is broken in places); my problem is with the equivalent of saying, 'hey, English spelling is terrible, soh Aiv dəseidid tū dəvelup mai ohn.'

Re:Fish: A user-friendly command line shell for macOS, Linux... by geoelectric on Wednesday December 13, 2017 @02:48PM (#15916989)
Back in the day I used to use csh and tcsh, both of which had famously landmine-laden scripting gotchas. So, I wrote my scripts in sh or bash. Now that I use zsh mostly, same thing, I don't actually write my scripts in zsh--especially for production, I write them in sh or bash. zsh for me is an interactive CLI-only tool. Honestly, I think the problem here sounds more about not standardizing on a common denominator for shared scripts.

Where stuff like fish is a pain for me is with apps that for whatever reason need shell integration (virtualenv, for example). Non-POSIX shells end up being an afterthought there, so you end up with no or buggy support, and end up having to find some other custom variant (virtualfish, etc.) to get good behavior. Sticking with a more mainstream shell tends to be safer there, and zsh barely makes it over that line.

Re:Fish: A user-friendly command line shell for macOS, Linux... by alphaalpha101 on Wednesday December 13, 2017 @12:18AM (#15912196)
It's nice to be able to simply copy-paste commands from the internet sometimes. (obligatory: yes you have to be careful when you do.)