Live data from Hacker News

The fish shell is amazing

rmpr.xyz

51–60 of 302 posts

Re: The fish shell is amazing

#51

More and more often, I am getting the following error: Malware and Phishing This site is blocked because it is a known security threat. Please contact your network administrator to gain access. My assumption this is because I have Xfinity Business Class and it's blocking the site. But why would I be seeing this so often on a site linked from HN?

It could be that the web filter in question has no info about the site rmpr.xyz, and therefore gives it an unfavourable score.

You might want to reach out to Xfinity support, or bypass their filter using a VPN or proxy.

Re: The fish shell is amazing

#52
post #18

Earlier quoted context omitted.

But seems to want us to replace the old reliable shell with it (Or this is what I understand). I see a lot of people reinventing the wheel in Linux and trying to appeal the new users. What you have in the end is normally worse than the standard ones. Is just dissecting Linux in a lot of smaller particles and smaller rooms. So thanks, but not thanks. Not to me. Wouldn't be much more practical to use all of those talen…

There are lots of "old reliable shells" that are POSIX incompatible. (t)csh[1] is the first family that comes to mind. The EEE analogy is more applicable to GNU Bash anyways: it extended the POSIX sh baseline with a bunch of GNUisms that a lot of "POSIX" sh scripts now unintentionally use. [1]: https://en.wikipedia.org/wiki/C_shell

I do not think that there are many GNUisms in bash, even if indeed there are a few optional syntax variants that should be avoided for compatibility with other shells.

In any case I am not aware of any GNUism that is actually useful in scripts, so taking care to not use any syntax variant specific to bash is not a problem.

All the important bash features that are not POSIX are not GNUisms, but they are:

1. The 50% of the new ksh 1988 features that have not been included in the POSIX shell, e.g. condition testing "[[ ... ]]" and arithmetic testing "(( ... ))".

2. All the new features added by ksh 1993, none of which have been included in POSIX, e.g. "for (( ... ))" and the extra parameter expansions that replace the most common invocations of sed or awk.

3. The brace expansion from csh

4. The extended brace expansion forms added by zsh (which generate arithmetic progressions and are usually preferable to "for ((...))")

Attempting to write POSIX-compliant scripts in 2021, i.e. not using these extra ksh/csh/zsh features provided by bash, is a huge mistake in my opinion, because without these features any non-trivial script becomes much longer and much more error-prone.

The Google recommended style for shell scripts (https://google.github.io/styleguide/shellguide.html), which is based on using all bash features, is pretty decent. It is far less work to ensure that bash or ksh/zsh exists on any target system than to maintain any obsolete POSIX-compliant scripts (which are stuck to the 1979 Bourne shell features + only half of what ksh 1988 has added).

Re: The fish shell is amazing

#53

Not for me, it breaks the .sh scripts and have to be rewritten.

You don't need to rewrite any script as long as your scripts have the correct shebang, those scripts works perfectly.

I would strongly not advise to make it the default shell though as this can lead to issues. The way I use it is to have bash as my main shell but my .bashrc starting fish if it's not started explicitly from bash: (it's a trick form arch wiki)

if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]] then exec fish fi

I've been using fish for a long time with this setup and never encountered an issue.

Re: The fish shell is amazing

#55
post #7

I used fish for a couple of years and really liked it. But I recently learned that I can configure ZSH to have all of the same auto-complete and plugins that I loved from fish. Now I have all of the creature comforts I like, with POSIX compliance I found that while fish has better syntax than bash for most things, the hassles with incompatibility or unexpected behavior brought me much more trouble than BASH's syntax…

Interestingly I moved from such a zsh setup to fish a couple of years back. Zsh with add-ons was noticeably slow compared to fish and syncing the config to all the devices I used.

Re: The fish shell is amazing

#56
post #27

I really love fish and the philosophy behind it, especially the "configurability is the root of all evil" attitude. Makes for a well though out software that is a true pleasure to use.

I love that philosophy too. If there's too many knobs to turn I'm going to constantly fiddle with them. The only things in my config.fish are calls to scripts to setup iTerm 2 integration and the Starship prompt.

Re: The fish shell is amazing

#58
post #7

I used fish for a couple of years and really liked it. But I recently learned that I can configure ZSH to have all of the same auto-complete and plugins that I loved from fish. Now I have all of the creature comforts I like, with POSIX compliance I found that while fish has better syntax than bash for most things, the hassles with incompatibility or unexpected behavior brought me much more trouble than BASH's syntax…

Any suggestions? I’ve recent switched from vanilla bash to ZSH. I mainly use oh-my-zsh and Power10k. Once again the defaults without much customization.

My only plugins are zsh-autosuggestion (https://github.com/zsh-users/zsh-autosuggestions) zsh-syntax-highlighting (https://github.com/zsh-users/zsh-syntax-highlighting) and zsh fzf-tab (https://github.com/Aloxaf/fzf-tab) its been wonderful using these plugins

Re: The fish shell is amazing

#59

Not for me, it breaks the .sh scripts and have to be rewritten.

+1. What's the point of a great shell, if I can't run the millions (!!) of existing scripts without refactoring them?! Zsh does the autocompletion just as well, so I'll stick with that.

Here's how you run POSIX code inside a fish shell:

    bash

Re: The fish shell is amazing

#60
post #16

As another commenter pointed out, while Fish has some nice out-of-the-box features, they’re all achievable in Zsh with a few lines of plugins. And did you know Zsh has a short for loop? Along with fantastic plugins like fzf-tab, I don’t see a reason to use anything else right now. Though, I’m keeping a very interested eye on Nu shell. They’re doing a lot of stuff right, and I expect it will become a very useful scrip…

Zsh has become an indispensable power tool for me. I am interested in other shells (especially PowerShell), but Zsh is now embedded deep in my brain, next to Vim and Python, and I doubt I will ever seriously migrate away. That said: what do you like about Nu shell specifically?

> what do you like about Nu shell specifically?

A whole bunch of things:

1. abandonment of POSIX shell syntax. We can do better. I'm happy with Zsh being POSIX-compatible, and that will always be there.

2. a focus on structured data. Nu basically has hierarchical dataframes built-in, along with lots of facilities for their manipulation. There have been a few other attempts at this but the benefits are obvious. Rather than figuring out how to `awk` your way through whatever text output a command generates, command output in Nu is structured and everything can be handled in orthogonal ways.

3. modern conveniences built-in, like syntax highlighting, and AFAIK they want to include features like "do something when you cd into a directory" that we currently need more tools for (i.e. direnv, which I highly recommend!)

4. serious technology. The people behind it are experts and JT has been showing off (https://youtu.be/3o8b_QcrFHc) the engine that enables trivially parallelizable loops. No more need for `xargs`.

5. I hesitate to mention "made in Rust" as a feature, but using a modern language for core infrastructure does matter.

Post reply on HN