Live data from Hacker News

The fish shell is amazing

rmpr.xyz

261–270 of 302 posts

Re: The fish shell is amazing

#261

Earlier quoted context omitted.

> A whole bunch of things: I appreciate the clarity of your message... curiously enough all the things that you mention I see them as anti-features of nushell (except the first one) 1. Posix shell is clunky has its limitations but there's nothing really flawed about it. It is nice to have non-posix shells, though; in that I agree with you. 2. I hate hate hate the very concept of dataframes. They seem like a useless o…

> Posix shell is clunky has its limitations but there's nothing really flawed about it. I think shellcheck is the best argument against this. POSIX shell is just stuffed to the brim with weird gotchas, places where the obvious way to write something causes subtle bugs down the line. It's the only programming language I use that feels adversarial , where you have to be paranoid to properly solve simple tasks. (Admitte…

> It's the only programming language I use that feels adversarial

This may be just that you are not very used to the language. I have the same dreadful feeling (that the language fights against me), even when using languages that I'm reasonably proficient with.

For example, in C++, a simple expression like "y = f(x);" already gives me the chills... Is the () operator overloaded? and the assignement operator? If the object x has size equal to 10GB, and y is supposed to have the same size, how much memory does this operation require? 10GB? 20GB? 30GB? 40GB? each of these completely different answers is perfectly reasonable, depending on extremely delicate details of the implementation.

Garbage-collected languages are even worse, I never know whether they will start a memory reclaiming spree that will halt my program for a few seconds.

Even in python, I have this sort of jump scares a few times per month.

Re: The fish shell is amazing

#262
post #248

Earlier quoted context omitted.

I am a fish shell user, but for me the biggest drawback is that a lot of tools rely on updating bashrc as part of installation and some of them don't have an equivalent `config.fish`.

> ... a lot of tools rely on updating bashrc as part of installation and some of them don't have an equivalent `config.fish` such as?

For example, Macports puts its installed binaries into /opt/local/bin (and sbin), and the installation process put this into my .profile:

  # MacPorts Installer addition on 2016-07-01_at_00:46:04: adding an appropriate PATH variable for use with MacPorts.
  export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
  # Finished adapting your PATH environment variable for use with MacPorts.
And I had to put the fish equivalent of that into ~/.config/fish/config.fish myself.

Re: The fish shell is amazing

#263
post #147

Earlier quoted context omitted.

Another issue with zsh plugins is that they are incredibly slow. Oh-my-zsh makes every terminal feel like it’s running on another machine over ssh

Ditch omz and use Prezto with the Powerlevel10k prompt (just change the theme in the zpreztorc file to 'powerlevel10k' and restart your terminal), follow the initial prompts for setup, with "instant prompt" enabled and you'll never go back.

Thank you for this, I had somehow stumbled across powerlevel10k years ago on my "fooling around" laptop and liked it but couldn't remember how I'd gotten there. Long time zsh user here, just last week started playing with oh-my-zsh to integrate into my main system's shell environment.

Re: The fish shell is amazing

#264
post #214

Earlier quoted context omitted.

This shouldn't be an issue! Shell scripts begin with e.g. #!/usr/bin/env bash which means the interactive environment is irrelevant. Users of nonstandard shells like fish need to learn a bit of on-the-fly translation if they expect to copy/paste into their terminals, but it isn't too onerous.

Not going to ping my coworker that deals with this (Happy Thanksgiving), but the version shipped with OSX was several versions behind Linux.

I just checked it on my Mac and my Ubuntu server.

MacOS has version 3.2.57(1) Ubuntu has version 5.0.17(1)

Apparently Apple cites license concerns as the reason for not upgrading it. Don't know how valid that is.

License on version 3.2.57 is GPLv2 License on version 5.0.17 is GPLv3+

It's simple enough to update if you use homebrew.

`brew install bash`

Add the brew version of bash to the /private/etc/shells and change the shell.

Re: The fish shell is amazing

#265
post #118

Specific question for anyone who's gone from bash to fish (and maybe back) -- Does the "only splitting on newlines" mess you up? I've just been in bash so long that I feel like this will get me?

You mean not splitting on spaces? No, never, ever bit me.

Speaking with my fish developer hat on:

The only common case where we find that splitting on spaces is actually needed is pkg-config and related tools, because that prints flags to be passed to the compiler, and it does it with spaces so it looks nicer and copy-pasteable:

    $ pkg-config --libs gio-2.0
    -lgio-2.0 -lgobject-2.0 -lglib-2.0
(ideally, it would simply use newlines here, which bash et al would also split on)

Typically, the easy workaround is `string split " "`:

    > somecommand (pkg-config --libs gio-2.0 | string split " ")
Otherwise, this is quite rare in practice. Most unix tools already operate on a line-by-line basis, which allows them to be easily greppable.

Re: The fish shell is amazing

#266

Earlier quoted context omitted.

> ... a lot of tools rely on updating bashrc as part of installation and some of them don't have an equivalent `config.fish` such as?

For example, Macports puts its installed binaries into /opt/local/bin (and sbin), and the installation process put this into my .profile: # MacPorts Installer addition on 2016-07-01_at_00:46:04: adding an appropriate PATH variable for use with MacPorts. export PATH="/opt/local/bin:/opt/local/sbin:$PATH" # Finished adapting your PATH environment variable for use with MacPorts. And I had to put the fish equivalent of t…

Umm, you don't need to define your PATH variable in `config.fish`, not unless you make it your default login and user shell.

You should keep using bash as your default login and user shell, define your environment variables, like PATH, in your `.bashrc`/`.bash_profile` but use fish as the default shell of your terminal emulator. In that case, fish should pick up the PATH from bash.

Re: The fish shell is amazing

#267

Earlier quoted context omitted.

To the best of my knowledge, Bash’s parameter expansion syntax[1] is entirely an original, non-POSIX GNUism. It’s extremely common and useful in scripting. And that’s just one small example. [1]: https://www.gnu.org/software/bash/manual/html_node/Shell-Par...

No, all the kinds of parameter expansion that exist in bash belong to 3 groups: 1. expansions introduced by the Bourne shell in 1979 2. expansions added by the Korn shell in 1988 (e.g. ${parameter#word} and ${parameter%word}) 3. expansions added by the Korn shell in 1993 (e.g. ${parameter:offset:length} and ${parameter/pattern/string}) There are no parameter expansions that have been introduced by bash. I agree that…

Are the case modification and @operator in ksh also? @Q is the one I use on occasion.

Re: The fish shell is amazing

#268
If you would like to add all these FISH things to ZSH:

- highlighting and displaying last suggested command execution from history

- file/dir highlighting

- commands coloring and stuff

Then check 'UPDATE 1' from here:

https://vermaden.wordpress.com/2021/09/19/ghost-in-the-shell...

I can not use FISH as it does not honor the POSIX syntax for loops and stuff and I often type 'for' and 'while' POSIX loops at command line so I use ZSH. Besides that FISH is really nice shell.

Regards.

Re: The fish shell is amazing

#269
Can anyone recommend a "sane zsh defaults" config that I can download and just works with approximately the same features as fish?

(Without having to first learn/spend time about howto setup and configure plugins etc.)

Re: The fish shell is amazing

#270
post #220

Earlier quoted context omitted.

Is it that hard to remember a bash for loop? for i in $(seq 1 10) do echo $i done Then you can just replace new lines with ; if writing a one liner. for i in $(seq 1 10); do echo $i; done I guess it isn't as simple as python for i in range(10): print(i) but it's pretty close aside from the variable binding.

Bash has some subtleties around loops that can be frustrating, like the body of your loop _may_ actually be running in a subshell (common when iterating over a file), making it difficult to extract what you want from it.

i bet it's the `cat file | while read …` loop what you are referring to, not any loop. but correct me.
Post reply on HN