Live data from Hacker News

Fish shell 3.0

github.com

91–100 of 227 posts

Re: Fish shell 3.0

#91
post #31
post #29

Earlier quoted context omitted.

That's included, just the `~2` shortcut thing isn't.

Which is included? I couldn't find anything like "dirs -v" in the fish manual. Without that, "pushd +N" isn't very useful.

There's a "dirs" command, which lists the directory stack, and a "cdh" command, which lists your directory history.

Re: Fish shell 3.0

#92

Something I've been thinking about this week as a vanilla bash user: Does Fish (or zsh, or others) have the ability to maintain some sort of a global command history? I often find myself wanting to run the same command in multiple terminals and currently just copy-paste.

In fish you can use `history --merge` to merge the current shell's history with other instances of fish.

Re: Fish shell 3.0

#94
post #47

Earlier quoted context omitted.

Forking off a subshell is very different, I would think, than forking and execing a new shell, both from a resource standpoint and an open file standpoint.

Not really from a usage perspective though, and resources often don't matter. If you're doing something like this in the background, then that usually means it takes a "long" time (or you'd just wait for it). So the overhead of starting an additional shell simply isn't important. Not that it's always irrelevant, but that's why the issues are still open.

Agreed, resources often don't matter.

But I do often do something like:

( cd somewhere ; do_something )

just so I can avoid having to do

pushd somewhere ; do_something ; popd

(or the equivalent).

Re: Fish shell 3.0

#95
post #79

Earlier quoted context omitted.

What? That's been in for a few releases! To trigger it, enter a single-quote, then paste the URL, then close the quote once you're done. We don't attempt to detect URLs because that can go wrong, and because we don't know your intention. So we use the fact that you're inside single-quotes as the signifier that we should escape things - which also allows this to be used for e.g. pasting shellscript as a literal argume…

There must be a disconnect here, manually entering a single quote, then pasting my URL, then adding the closing quote is precisely what I wish to avoid. Here is a demonstration about what I'm talking about: https://i.imgur.com/d64lwaB.mp4 > "We don't attempt to detect URLs because that can go wrong, and because we don't know your intention." That much I've gathered from seeing this issue raised with fish people in th…

> How often do users of the fish shell paste a string that starts with 'http' and contains a '?' that is meant to be a wildcard?

Okay. Now you can do it for http. What about ftp? Or "file://"? Do we detect _all_ kinds of URLs?

And even if we do, and we don't miss some or see something as a URL that isn't, what about _other_ kinds of things? What about shellscript? E.g. if I want to just execute a bash one-liner from the internet, I can do

    `bash -c '`
and paste it and it'll work out. That won't be detected as a URL, because it isn't one.

And I've seen a case of a URL with variables just yesterday (though I admit that's a coincidence):

https://docs.travis-ci.com/user/deployment/custom/ has "sftp://${SFTP_USER}:${SFTP_PASSWORD}@example.com/directory/filename". How do I paste that with the zsh thing? Do I need to go back and edit all of that?

So, instead, we have one rule: If you paste it insde single-quotes, it'll be escaped. If you paste it outside, it'll be inserted as-is (but still not executed). No matter what the contents, no matter where.

Re: Fish shell 3.0

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

> your particular preferred syntax

I think it's called POSIX.

Re: Fish shell 3.0

#97

Earlier quoted context omitted.

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

> your particular preferred syntax I think it's called POSIX.

You seem to be making some sort of argument, I just don't know what it is. Are you saying that fish is not production ready because it's not POSIX-compatible?

Re: Fish shell 3.0

#98
post #50

Earlier quoted context omitted.

Your quoting is a bit confusing, as "`cmd...`" and "$(cmd...)" are similar,, while backtick-dollar-paranthesis is just asking for trouble... ;) I take it fish didn't / doesn't support either?

Fish just uses (cmd), no $.

Ah, which I guess is why no subshell support?

Re: Fish shell 3.0

#99
post #33

To install on ubuntu if you don't want to build: sudo apt-add-repository ppa:fish-shell/release-3 sudo apt-get update sudo apt-get install fish https://launchpad.net/~fish-shell/+archive/ubuntu/release-3

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.

Re: Fish shell 3.0

#100
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 is a bummer. Took me 10 minutes (I'm ashamed to say) to end up at `if test -n "$git_branch"` (double quotes are critical).

I'll be excited when someone invents a shell that feels natural in this respect. Perhaps the nature of shells and commands makes this impossible? Or are we just stuck in a box?

Post reply on HN