News for hackers. Stuff that matters.
Re:Shell Has a Forth-Like Quality by djsumdog on Tuesday January 24, 2017 @10:49PM (#13478303)
I'm really excited about new shells. Fish has been mentioned here (which I've used for 2+ years). It's amazing and adds a lot of good functionality.

I also like that the author mentioned runit. I wish there was more documentation for runit, but I've been using it on Void linux and it's an amazing, damn simply init system. If an init script is missing for any package in Void, they are trivial to write. Most are less than three lines.

I also really like how the post author demonstrated how shell commands are composed in ways that traditional functions aren't composed; that is commands that change the environment for the command they run (environment variables, processor scheduling, security, input/output redirection). This is the very nature of an _implicit_.

Re:Shell Has a Forth-Like Quality by wtbob on Tuesday January 24, 2017 @11:39PM (#13478580)
> Fish has been mentioned here (which I've used for 2+ years). It's amazing and adds a lot of good functionality.

What does it add exactly? As far as I can tell, it's needlessly incompatible with POSIX shells, and doesn't do as much as e.g. zsh (or even bash?).

I'm not saying that zsh & bash are the end-all, be-all of shells, but I just don't see that fish improves on them.

And honestly, for config files I think we could do a lot worse than an s-expression language.

Re:Shell Has a Forth-Like Quality by ridiculous_fish on Wednesday January 25, 2017 @12:46AM (#13478945)
fish dev here. We love zsh and anyone pushing on what shells can do!

Here's where I think fish fits in. The main goals of fish are:

1. Thoughtful UI that just works

2. Sane scripting

zsh does more than fish, and we're happy to let it. The tradeoff is that zsh requires substantial configuration to realize that power - and once you get into the weeds, you will learn which options are incompatible with each other. zsh has 21 options controlling history, and fish has none, but you'll probably be happier with fish's defaults.

fish has a smaller feature set, but that feature set just works out of the box: tab completions, syntax highlighting, autosuggestions, etc. Customizations (prompt, colors, etc) can be done with a web UI or a nice command line interface, and not arcane syntax (PS1=...)

The hope is you can be more productive in your shell without needing to invest tons of time configuring and learning it.

Re:Shell Has a Forth-Like Quality by danielvf on Wednesday January 25, 2017 @07:53AM (#13480979)
I've been using fish since 2013. It's amazing how well it anticipates what I'm trying to do, and just makes life better.

The biggest amazing default is to be able to start typing and have it be searching the history. When I'm ready to start work on a project I can start typing part of the project's name, say "bar", and fish will come up with a history item for "cd /customers/foocorp/barproject".

I still do my "scripting" shell work in bash though, since it runs everywhere.

Re:Shell Has a Forth-Like Quality by marklgr on Wednesday January 25, 2017 @02:01AM (#13479344)
> adds a lot of good functionality.

Parent's comment is misleading, then. As someone who already has a pretty solid grasp of Bash, when I peeked at Fish it looked like there was nothing that it would gain me -- though I understand that the preconfigured shell can be useful for people who don't have the time to learn and tweak it.

Re:Shell Has a Forth-Like Quality by ridiculous_fish on Wednesday January 25, 2017 @04:14AM (#13479937)
If fish has a hook (har har), it would be autosuggestions. fish suggests the rest of the command as you type, like your web browser does for URLs. This feels faster than tab completions, because you can see what command you'll get ahead of time. It also lets you summon commands from history quickly, without having to think about it - just start typing.

If you're a die-hard bash user, autosuggestions are the feature most likely to pique your interest and make the command line more pleasant.

Re:Shell Has a Forth-Like Quality by marklgr on Wednesday January 25, 2017 @05:07AM (#13480165)
Will take a look, but 'history-search-backward' fills most of my needs in that regard.
Re:Shell Has a Forth-Like Quality by djsumdog on Wednesday January 25, 2017 @02:23PM (#13484990)
You really should. Once I got use to the fish auto-complete history, the Bash reverse search felt terribly primitive. There is no Ctrl+R. Just type part of an old command and hit the up arrow to scroll.
Re:Shell Has a Forth-Like Quality by wtbob on Wednesday January 25, 2017 @09:59AM (#13481864)
> you'll probably be happier with fish's defaults.

Probably (although I use a zsh distribution to get a sane setup). I definitely appreciate the idea of sane defaults, rather than forcing the user to set everything up properly from scratch. And your autosuggestions do look pretty swell.

> Customizations (prompt, colors, etc) can be done with a web UI or a nice command line interface, and not arcane syntax (PS1=...)

You ship a web server in the shell? Is it always running, or does the user have to do something to start it up?

I kinda like setting variables, to be honest. But I'm old-fashioned.

One thing I really wish y'all'd done was use more standard shell syntax. It's really painful working in an office where someone uses fish and lets fish-isms creep into shared command libraries.

Re:Shell Has a Forth-Like Quality by Sean1708 on Wednesday January 25, 2017 @10:34AM (#13482187)

  >  Is it always running, or does the user have to do something to start it up?
Looks like the latter: https://fishshell.com/docs/current/commands.html#fish_config
Re:Shell Has a Forth-Like Quality by noir_lord on Wednesday January 25, 2017 @07:47AM (#13480940)
Off topic but are you the same ridiculous_fish that used to hang around programming:1 on yahoo circa 1999/2000?
Re:Shell Has a Forth-Like Quality by ChrisClark on Wednesday January 25, 2017 @12:52AM (#13478977)
And that's exactly why I love fish, I just install it and go. Thanks!
Re:Shell Has a Forth-Like Quality by shakna on Wednesday January 25, 2017 @12:07AM (#13478714)
Fish is similar to zsh in a lot of ways, but without configuration you get the best of zsh:

* Syntax highlighting

* Implicit cd to directory

* 100,000 line history

* History de-duplication

* Inline auto-suggestions

* Tab completion using man page data

* Paginated completion

* Copy/paste using X clipboard

The only things I feel the need to configure on a new fish install, is PATH and my prompt. Because I'm pedantic and like things exactly so.

You can get these with zsh, but it's more than apt-get install.

Re:Shell Has a Forth-Like Quality by enriquto on Wednesday January 25, 2017 @12:57AM (#13479006)
Why the line history limit, though?

I do not want that my lines get deleted silently. ever. I would rather prefer that random files on my disk are deleted, before that. Is there any shell without line history limit?

Re:Shell Has a Forth-Like Quality by ridiculous_fish on Wednesday January 25, 2017 @04:44AM (#13480061)
History is limited because very large history files could make the shell slow! Shells are often used to recover from exceptional conditions (out of disk space, `rm -rf /`, etc) so it's important they be responsive no matter what.

bash's history limit is by default the last 500 commands, without considering duplicates. In practice this limit is easy to exceed, which is why bash config guides recommend upping it.

fish's history limit of 2^18 (~256k) commands is really more of a sanity check. Duplicate commands are counted only once, and commands are discarded by LRU (not oldest). This means history only starts being dropped after hundreds of thousands of unique commands. If you in fact run that many distinct commands, I'd love to hear more about your use case!

Re:Shell Has a Forth-Like Quality by IsmaOlvey on Thursday January 26, 2017 @05:51AM (#13490328)
Bash is still very responsive with 150k+ history entries. The only noticeable performance impact is increased startup time when the history file is not in disk cache.
Re:Shell Has a Forth-Like Quality by trengrj on Wednesday January 25, 2017 @01:02AM (#13479036)
I made a hack that gives me an SQLite database of command line history for bash https://github.com/trengrj/recent
Re:Shell Has a Forth-Like Quality by shakna on Wednesday January 25, 2017 @01:04AM (#13479045)
You may want to read through this [0], for a better understanding of why these limits exist, and how the high limit in fish might be enough for you.

[0] https://github.com/fish-shell/fish-shell/issues/2674

Re:Shell Has a Forth-Like Quality by tomsmeding on Wednesday January 25, 2017 @02:51AM (#13479570)
Um — I'd rather not that random files on my disk be deleted. :P Rather have a history line limit in my shell.
Re:Shell Has a Forth-Like Quality by IsmaOlvey on Wednesday January 25, 2017 @07:50AM (#13480956)
In bash, you can remove the limit by setting:

    export HISTSIZE=-1
    export HISTFILESIZE=-1
When the history file is not in the disk cache, startup time will increase noticeably after a while though (think a second, maybe two).
Re:Shell Has a Forth-Like Quality by JdeBP on Wednesday January 25, 2017 @03:40AM (#13479786)
What documentation would be more documentation?