Live data from Hacker News

Fish shell 3.0

github.com

161–170 of 227 posts

Re: Fish shell 3.0

#161
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.

> Starting at 1 is good for non-programmers, who IMO could benefit the most from switching to Fish. I couldn't disagree more. Any tool where you have to say "all these other tools you are used to just working don't work here" is the last thing I would recommend to a non-programmer.

Re: Fish shell 3.0

#162
post #41
post #39

I was hoping to see that they added a `time` command, which is something that makes me change to bash every once in a while.

There's an actual program, usually installed in /usr/bin/time. The shell builtin is not really necessary.

There's an outstanding issue in the github because the binary doesn't let you directly time fish functions. You can do

time fish -c '[function]'

but that includes the time to launch fish.

This, of course, wouldn't matter for any reasonable usecase but I like a fancy prompt and don't like waiting for it to run.

Re: Fish shell 3.0

#163
post #67

Let me know when it's posix compliant.

As soon as your bash scripts run with /bin/sh.

You can still have bash installed and anything that requires significant scripting could probably be done easier with a language for scripting. I want my shell for my terminal. This is also the reason I don't like the verbosity of Powershell, however much an OOP paradigm better supports scripting.

Re: Fish shell 3.0

#164
post #114

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…

sometimes I wonder if "native" support for regexes would help this, or if it would just be another instance of https://xkcd.com/1171 regexes describe this sort of thing quite concisely and IMO a fair bit more readably than e.g. bash's string replacement syntax, which looks like "${var#"${var%%[![:space:]]*}"}" when you want to do the equivalent of s/^\s*(.*?)\s*$/\1/

It wouldn't even be another standard; it'd just be another incompatible implementation with its own quirks to be worked around.

Re: Fish shell 3.0

#165

Earlier quoted context omitted.

To install on Arch (w/yay), `yay -S fish`. (just a plug for how easy it is to install packages on Arch)

Adding the usual disclaimer that yay is an AUR helper and thus not officially supported by Arch. Arch users are advised to read https://wiki.archlinux.org/index.php/Arch_User_Repository instead. If you know what you're doing, of course using yay should be fine as well.

It should be noted that adding a PPA is equally unsupported, so in both cases you're trusting a third party.

Despite all the disclaimers (or perhaps because of them), the AUR is IMHO one of the more safe and well-thought-out ways of including third-party stuff. It's relatively simple to verify that the package is installing what it says it is, because you can check the PKGBUILD file, which is short and simple to read. I would have no idea how to go about verifying that a .deb file was what it said it was.

Re: Fish shell 3.0

#166

Earlier quoted context omitted.

To install on Arch (w/yay), `yay -S fish`. (just a plug for how easy it is to install packages on Arch)

Does yay come default on arch linux?

Enough people use it that it would make sense to have it in the official packages. However, having to download and build at least one AUR package (yay itself) manually is an important part of being familiar with the process so that you are more likely to take precautions with third party stuff you later install from the AUR.

Installing an AUR package without a helper (which you have to do to install a helper in the first place) basically amounts to:

    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si

But then you would have to manually check for updates etc, so the helpers are pretty useful.

Re: Fish shell 3.0

#167

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

fish doesn't try to support all of the weird historical quirks of Bourne-style shells, so its grammar and built-in 'API' are far simpler and clearer. Its out-of-the-box configuration is much much nicer for most people than zsh's. Completion definitions are easier to read/write. Its source code seems less byzantine. And its GitHub-based development model is more accessible.

The down side is that it's functionally very limited compared to zsh. fish's completion functions are easy to maintain, but the trade-off is that they don't offer the fine-grained contextual control over behaviour that zsh's do. Features like globbing, sub-shells, job control, co-processes, modules, &c., are absent or extremely limited. There are fewer knobs and switches, though as mentioned it tries to do the right thing for most people by default. And a consequence of the syntax being clearer is that it's also much more verbose, which i guess you may or may not appreciate.

Over-all i think fish is a good shell for the (very common) type of person who doesn't really care about shells but was drawn to zsh just because it has nicer completion than bash and lets you write fancy prompts. I don't think it's a good fit, yet, for people who write complex scripts or regularly make use of stuff like extended globs, background jobs, and fancy parameter expansions.

Re: Fish shell 3.0

#168
post #44

Earlier quoted context omitted.

That reminds me of the very specific nag messages I get from Python 3 when I don't write parens around parameters for print... do what I want already.

What does someone want if they write "bar = print foo,"? Is it the same if "print" isn't the built-in function?

Operator precedence isn't really a new concept, and Python relies on it in plenty other situations:

    bar = 1 + 1
I do believe Python made the right call, actually: print needed to be unified with functions, and dropping the requirement for parenthesis for function calls would have introduced so much incompatibility as to make the Python 2 -> 3 transition far more difficult.

But ignoring the legacy issue, there is a better way to do function calls, and it is ruby.

Re: Fish shell 3.0

#169

I loved Fish while I used it. I recently stopped using it because I'm writing a lot of documentation. I prefer to do thing using bash or zsh now so I can be sure it will work for others.

I run tcsh. It won’t.

You know you run tcsh. fish users usually know they run fish. You don't expect to be able to run arbitrary copy-pasted shell snippets in the first place.

Re: Fish shell 3.0

#170
post #141

Earlier quoted context omitted.

URL pasting is indeed annoying. That said, second-guessing the user's input is dangerous territory, which is why no shells do what you describe by default. The way we plan to address this in fish is to make ? an ordinary character instead of a wildcard. Then URLs will have nothing to escape. You can opt into this change today by setting the 'qmark-noglob' feature flag: set -U fish_features qmark-noglob now ? no longe…

How is parsing "^https?://." a second guessing? It's a URL.

The user inputs ? but the shell inserts \?. The shell would be guessing that the user meant to input something different than what was actually input.
Post reply on HN