Live data from Hacker News

fish shell

fishshell.com

61–70 of 78 posts

Re: fish shell

#61
post #57

Earlier quoted context omitted.

I just checked, for fun: $ ls -lh .bashrc -rw-r--r-- 1 10k Jul 26 13:31 .bashrc Yep. It's also remarkably fast because I took great effort to optimize the parts that happen the most. Shell is actually pretty fast if you don't fork and exec all the time...

What do you have in it that takes up so much space? FYI: I'm not being argumentative, I am genuinely curious.

Well, it's about 400 lines total. Roughly 40% of that is PATH handling functions: add_to, append_to, replace_in, remove_from, prefix and unprefix. They're used like:

    add_to PATH /usr/sbin
prefix and unprefix are a macro for a bunch of standard replace_in/remove_froms:

    prefix() {
        replace_in PATH "$1/bin"
        replace_in PATH "$1/sbin"
        replace_in PATH "$1/lib/ccache"
        replace_in MANPATH "$1/share/man"
        replace_in MANPATH "$1/man"
        replace_in PKG_CONFIG_PATH "$1/lib/pkgconfig"
    ...etc.
So that later I can do stuff like:

    prefix /usr/local
    prefix /usr/local/brew
    prefix /usr/local/ports
...All of which are managed by different package managers (stow, brew, ports).

All that stuff is the part I optimized so that it only uses bash built-ins and never execs. Converting that away from sed/perl shaved about 8 seconds off my startup time (it's now so fast I don't notice it).

The next 20% is interactive stuff. Setting up the prompt, aliases, stty, etc. This is generally more complicated than it technically needs to be because it's cross platform so it'll run on any unix-y thing with no changes.

Then remaining 40% is a big chunk of shell functions that are mostly unused in my day-to-day life, but kept there to jog my memory if I need to do a certain task.

That adds up to 100%, but it's also worth noting that 27% of that is blank lines and comments.

Re: fish shell

#63

I've been using fish for a while now. Overall it's pretty great. Here's my fish config if you want to see an example: https://bitbucket.org/sjl/dotfiles/src/tip/fish/config.fish

Gotta say, this one is my favorite: 112 function hey_virtualbox_shut_down_or_i_will_fucking_cut_you 113 VBoxManage controlvm $argv poweroff 114 end

A powerful demonstration of self-documenting code. I applaud the application.

Re: fish shell

#64
post #18

The fact that you cannot redirect stderr to stdout and pipe to another command is a bit of a stumbling point for me. When I saw the bug[1] for the first time I thought that it must be some strange corner case, but it turns out it is a real bug. After reading the bug report I started to wonder if there were any other other unixy features that were missing. I/O redirection is a core unix concept in my opinion. [1] "Red…

It actually made me switch back to zsh. Pipe not working is just a no go for me. But overall, this is a great shell, very accessible compared to bash/zsh, I particularly appreciated the configuration mechanism.

Re: fish shell

#65

I really liked fish, but as someone who is still learning bash/cli scripting, it makes things difficult when instructions from programs come only in Bash syntax, which does not work well with fish (some things with homebrew were an absolute nightmare to install).

It definitely makes following instructions a little more complex, but in most instances when a line doesn't work I've found that a quick switch over to bash to run that line and back proves to be sufficient.

Of course I'm also very new to bash/cli so I'm just happy if I can get things done and haven't yet gotten to the stage where I'm worrying about if it's the proper way to go about doing things.

Re: fish shell

#67
post #32
post #18

The fact that you cannot redirect stderr to stdout and pipe to another command is a bit of a stumbling point for me. When I saw the bug[1] for the first time I thought that it must be some strange corner case, but it turns out it is a real bug. After reading the bug report I started to wonder if there were any other other unixy features that were missing. I/O redirection is a core unix concept in my opinion. [1] "Red…

It doesn't have process redirection either, and that's one I use a fair bit. For example paste Where hquery is one of my utilities for running xpath queries over loosely parsed HTML. This would produce a tab-delimited list of link urls to link text.

Try piping into psub, as in

    paste (hquery -q '//a/@href' x | psub) (hquery -q '//a' x | psub)
http://ridiculousfish.com/shell/user_doc/html/commands.html#...

Re: fish shell

#68

I like auto-complete in web-browsers, but I can't see a single use for it in my terminals. After all, what Linux-user hasn't automated their terminal input to some degree? Nah, I'll stick with my [TAB]...

You could just try it instead of speculating

I tried it for a while and I just can't work with it. I'm back to fish 1.23 for now, and I don't know what I'll do when that becomes unmaintainable. I might just have some personal patches, I really wish they included an option to disable it.

Re: fish shell

#69
"Finally, a command line shell for the 90s"

Now that's an odd slogan. Is it trying to make the point that the competition is even older? Appeal to old-school hackers? Subtly tell me that the project hasn't been updated in a while?

Re: fish shell

#70
post #69

"Finally, a command line shell for the 90s" Now that's an odd slogan. Is it trying to make the point that the competition is even older? Appeal to old-school hackers? Subtly tell me that the project hasn't been updated in a while?

It's satire.
Post reply on HN