Live data from Hacker News

Fish shell 3.0

github.com

131–140 of 227 posts

Re: Fish shell 3.0

#131

Earlier quoted context omitted.

It seems to be mostly about math, with the only mention of array indexing being that 0 looks nicer. "starting with 0, however, gives the nicer range 0 ≤ i This doesn't seem to be much of an argument so I'm not even sure what to address.

How would you do something like Python's `x[0:10] + x[10:len(x)]` in a 1-indexed way? [1:11] + [1:len(x)+1]? That's uglier.

You just make ranges end-inclusive, and then it's x[1:10] + x[11:len(x)].

The best of both worlds is when a language provides both end-exclusive and end-inclusive slice syntax, as in e.g. Nim: x[0..<10] is end-exclusive, and it's very clear that it is.

Re: Fish shell 3.0

#132
post #129

Earlier quoted context omitted.

`fish --version` showed 3.0.0, after brew update but without closing terminal, but `ls && echo finally` still didn't work. However, closing and re-opening terminal, it now works.

`fish --version` starts a new fish that prints _its_ version. You were still running the old version, and `echo $version` would have told you.

Hah, oops, should have realised that.

Re: Fish shell 3.0

#133
post #58

Earlier quoted context omitted.

That’s new? Suddenly I feel less guilty about dodging coworkers who have been trying for years to get other people to try fish. But maybe now it’s getting closer to production readiness.

The fact that it doesn't support your particular preferred syntax doesn't mean it's not production-ready.

I‘m not switching to fish because of its lack of POSIX compliancy. This is a valid complaint.

Re: Fish shell 3.0

#134

Earlier quoted context omitted.

It seems to be mostly about math, with the only mention of array indexing being that 0 looks nicer. "starting with 0, however, gives the nicer range 0 ≤ i This doesn't seem to be much of an argument so I'm not even sure what to address.

How would you do something like Python's `x[0:10] + x[10:len(x)]` in a 1-indexed way? [1:11] + [1:len(x)+1]? That's uglier.

  julia> x = collect(1:15)'
  1×15 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15

  julia> x[1:10]'
  1×10 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
   1  2  3  4  5  6  7  8  9  10

  julia> x[11:end]'
  1×5 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
   11  12  13  14  15

  julia> x[11:length(x)]'  # alternatively ...
  1×5 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
   11  12  13  14  15

Re: Fish shell 3.0

#135

Can anyone who's experienced with both fish and zsh comment on reasons fish might be better?

For me it's the out-of-the-box autocompletions just work really well. Not sure I had the ultimate zsh completions setup before but I did try and was not able to get anything near as good as fish.

It's like fish can read your mind.

Re: Fish shell 3.0

#136

Earlier quoted context omitted.

The fact that it doesn't support your particular preferred syntax doesn't mean it's not production-ready.

I‘m not switching to fish because of its lack of POSIX compliancy. This is a valid complaint.

It is!

But calling it "getting closer to production readiness" feels a tad insulting.

It's probably just a bit of snark, so it's not worth getting up in arms about, but it's not really friendly phrasing.

Re: Fish shell 3.0

#137
post #69

I made fish my default shell for around a month, and I really liked the smart suggestions of what command I was going for when I started typing. But the "vi" mode had enough incompatibilities that it really irritated me, it was extremely incomplete. Discussions of it with devs went nowhere. Plus, there were incompatibilities in the language that I could never bring myself to commit to memory; I might have if the vi m…

ZSH seems to have broader community support and there's a plugin for basically everything. This is why I chose to stick with it over Fish. If I just wanted a very simple shell, with good defaults, I'd choose Fish. But much like why I use (Neo)Vim I prefer the DIY approach and have gotten my ZSH to the point over the years (and a hundred scripts later) where I love it. But ZSH the language is pretty awful and non-intu…

Why not just use fish for scripting? That's what I do as zsh as shell works better for me as well.

Shell scripting finally looks a little saner thanks to fish.

Re: Fish shell 3.0

#138

After 15 years, I still struggle to test if a string is empty in shell languages. Do I use square brackets, double square brackets, equal sign, double equal sign, test -n, set -q, wtf mate? Do I need to wrap my string variable in double quotes? single quotes? Fish looks great, and I'm going to give it a try, but I ran into these same old shell scripting issues within 2 minutes of trying to configure my prompt, which…

It feels a bit more natural once you've bent your mind enough to understand what the shell is doing. The trick is that `test` and even `[` (which is essentially another name for `test`) are ordinary commands, that exist as stand-alone binaries as well as identical-behaving built-ins. They masquerade as syntax, but they're really not. You can even call them from other, non-shell languages: >>> from subprocess import r…

Thanks for taking the time to explain the details.

If we were to start with a clean slate, could we come up with something natural while still having a clean design with respect to commands? Would it be worth it?

The fact that those details haven't sunk in after more than a decade points to an opportunity for a better design, I think. For example, I can pick up Go, Java, Perl, PHP, JS, Nim, etc and memorize the if-statement details in about 5 minutes. Whether or not anyone would use such a shell, I don't know.

Re: Fish shell 3.0

#139
post #37

I've been happily using fish for maybe two years now, just as a default shell and not doing anything fancy. Out of the box it is great. I'm not sure how to feel about only now learning its indexes start at a [1] though (╯°□°)╯︵ ┻━┻ Love it otherwise.

Starting at 1 is good for non-programmers, who IMO could benefit the most from switching to Fish. I would love to see a distro using Fish as the default shell for non-root users.

It would be nice but the distro needs to warn the user that copy pasting some shell script may break and would be nice if a converter is provided from bash to fish script.

Re: Fish shell 3.0

#140
I like fish's auto completion speed and smoothness but one thing that has held me back when I checked out fish was that there didn't seem to be a `Ctrl+r` command that bash and zsh provide to quickly go through history commands.
Post reply on HN