Top
Best
New

Posted by ravenical 1 day ago

The Case for Nushell (2023)(www.sophiajt.com)
63 points | 61 comments
yencabulator 19 hours ago|
Last I looked, Nushell

- error handling is neglected in the basic design: <https://github.com/nushell/nushell/issues/10633>, <https://github.com/nushell/nushell/issues/10856>, <https://github.com/nushell/nushell/issues/8615>, <https://github.com/nushell/nushell/issues/6617>

- control-C interrupts its internals with obviously-wrong error: <https://github.com/nushell/nushell/issues/8828>, is mishandled in other ways <https://github.com/nushell/nushell/issues/8206>

These bugs have existed for so many years I've 100% given up on Nushell. I recommend you don't subject yourself to software that is this level of unreliable and unbothered about being so unreliable.

(There's a lot of missing/misimplemented features, but the above is so severe they're not even worth mentioning.)

joemccall86 10 hours ago|
FWIW it looks like this addresses the pipe error behavior: https://github.com/nushell/nushell/pull/16449
tormeh 1 day ago||
If you're ever forced to use Windows, just install nushell. The speedup is wild, and along with it comes many nice quality of life features.

Nushell is good on the Unixes as well, but the defaults there are less annoying. I regularly revert to bash because there's just some thing I've memorized in bash, and bash doesn't make me want to scream.

Note that this is just my perspective on it as an interactive shell. I've never used it for scripting.

UltraSane 1 day ago|
Windows already has a very good shell called PowerShell.
tormeh 1 day ago|||
I've tried the stock Windows shell and utilities. `ls` is noticeably slow in directories with like 15 subdirectories. That's not acceptable. Even the terminal emulator is so slow pasting 30 characters takes several frames. That's not too annoying, but I might replace it with Wezterm or something.

The stock Windows terminal experience is awful. Windows has improved markedly recently with `winget`, so maybe they'll get around to fixing the speed sometime, too.

FergusArgyll 1 day ago||
Windows terminal and Powershell are 2 distinct programs
runjake 23 hours ago||||
Powershell is slow to start (~1-8 seconds on my PCs, even without a profile.ps1) and it performs pretty poorly in general (eg. processing texts and pipelines) compared to other options -- even Python by a wide margin.

I love Powershell and I wish MSFT would put a concerted effort into optimizing its performance.

int0x29 1 day ago||||
Powershell itself can be noticably slow to even start. Waiting a minute or two to hit a prompt is just annoying. Yes this only happens if you run Windows on a spinning disk but it's a shell. It's shouldn't require an SSD to run.
ZenoArrow 23 hours ago||
> Waiting a minute or two to hit a prompt is just annoying.

I've never experienced startup times anything close to a minute. Is your computer very old?

chasil 22 hours ago|||
There is one company who decides what PowerShell is, and they are not known for stability in many areas.

Just as easily as Aero switched to Metro, syntax in PowerShell will do what they want, despite impacts to your legacy scripting.

The POSIX shell, on the other hand, is a POSIX standard controlled by the Austin group. The classic adaptation is the Debian Dash shell, which is both tiny and fast, and changes are very, very slow.

Dash can be linked with libedit and used as an interactive shell. Everyone should do so, before learning non-standard extensions in Korn, Bash, Zsh, et al.

Shells are a matter of taste to a great extent. These are different envelopes of features, stability, and portability.

UltraSane 20 hours ago||
Powershell syntax is much much more consistent than Korn, bash, zsh, etc.
chasil 20 hours ago||
For now, Aero to Metro awaits you.

May you enjoy the trip, my friend. You deserve it.

UltraSane 17 hours ago||
Aero to Metro is completely irrelevant to powershell.
jiehong 1 day ago||
Still not super stable.

Each releases breaks something, usually, and it’s been like that for a few years (like the default config file that was generated is no longer parsed after an upgrade, or a function was renamed, etc.)

I guess they are trying to go this way with their standard lib somehow.

wpm 1 day ago||
Is

for i in 1..10 {

    print $i
}

really all that more readable than

for i in {1..10}; do

    print $i
done

Like, am I taking crazy pills? They're basically exactly the same!

kalterdev 1 day ago||
Bash is an advanced beast. In Bourne, it was

    for i in `seq 10`
    do
        print $i
    done
Which is pretty much readable though. The only issue is Pascal vs C syntax. As a fan of the former, I admit that the latter is more advanced: it stacks better. E.g. consider

    if (test -f junk) rm junk
against

    if test -f junk; then rm junk; fi
The former “avoids semicolons that Bourne requires in odd places, and the syntax characters better set off the active parts of the command.” [1]

1: Rc—The Plan 9 Shell https://9p.io/sys/doc/rc.html

wpm 23 hours ago||
The semicolon is required only when not using new lines to split the command words, as in

sleep 60; do_the_thing_that_needs_a_minute_wait

It's not necessarily required in the for loop either, I tend to prefer the more compact method of putting the "do" on the same line as the for. It can be written as

for i in {1..10}

do

    print $1
done

Having "done" be the signifier of the "the for loop context ends here" is 3 characters more than "}" or ")" or whatever else. "done" is more color coming off the screen with syntax-highlighting, and can be typed in two keypresses with a "d" and a "tab" in any editor from the last 30 years. It just seems like a very very inconsequential nitpick. At least Nushell doesn't pull a Python and just have "invisible space" be the end of the for-loop.

One line conditionals are doable as well in the shell.

test -f junk && junk

or

[[ -f junk ]] && junk

You can even just use [ -f junk ] if double brackets is giving the yuck.

kalterdev 20 hours ago||
In practice, the only noticeable difference I have witnessed is

    for (f in *.c) if (test -f $f) cc $f
I can write the whole thing in a single line (which is essential in GUI and interactive contexts) and it reads well.
cassepipe 1 day ago|||
I have never seen the second version. Apparently it's there since bash 3.00 (2004). Maybe took inspiration from zsh who also has (or a common ancestor ?)
Qwertious 23 hours ago|||
The former is easier to remember. You can't forget the semicolon if there isn't a semicolon to forget.
runjake 23 hours ago||
It depends on where you're coming from.

To myself, I agree, but to a Windows native power user, the latter looks confusing.

Source: Windows native colleagues.

wpm 23 hours ago||
Imagine though, if we shell-heads came over to Windows and started writing an entirely new shell to replace Powershell because we didn't want to learn Powershell. It's just so utterly bizarre to me. I guess people like what they like, and that's cool, but wanting to rip out a 40+ year old scripting environment and command line shell because it doesn't look like goddamn Ruby or Clojure or Rust or whatever is just intolerable.
BadBadJellyBean 1 day ago||
I have always struggled a bit with shell replacements. I use zsh but only because of oh-my-zsh. Apart from that I always thought of shell scripts as a necessary evil for interoperability. Today you can usually expect a linux system to have bash or at least sh. That is why I do shell scripting. Nushell is usally not preinstalled on a system and so I cannot expect it.

If I want to do real scripting/programming I use python or another dedicated programming language. I don't really know what the value of Nushell is for me. Maybe the plugin system is amazing but at the moment I miss nothing in my zsh.

mmh0000 1 day ago||
I really would like a new shell that wasn't based on a poorly designed programming language from the 1960s[1][2]

However, I need to know sh/bash well because they're the tools installed by default; in any "well-established" organization, getting approval to install a new shell will range from "12 to 24 months" to "impossible". And without that, I'm not going to put in the effort to learn a new tool that is only useful some of the time and requires massive context switching.

[1] https://en.wikipedia.org/wiki/ALGOL_68 [2] https://en.wikipedia.org/wiki/Bourne_shell#:~:text=Stephen%2...

BadBadJellyBean 1 day ago||
That's what I mean. A new shell would need to blow me away with some amazing must have interactive feature. The scripting part is, at least for me, not really relevant. If I can install software on the target I will install a proper language and if not then it will be bash or sh anyways, even though they properly suck.
ZenoArrow 23 hours ago||
The "killer app" is that it's easy to string together multiple commands and have them work more reliably than shells that rely on plaintext. In other words, it's something in-between running individual commands and writing full scripts. I've not used Nushell before, but I'm very familiar with PowerShell which is similar, and it's ridiculously easy to manipulate and explore your file system with confidence that you don't have to rely on hacky and hard to read regex and similar suboptimal solutions.
kalterdev 19 hours ago|||
Python is good for general-purpose scripting, which does cover most of the tasks, but it’s still too bureaucratic when it comes to OS primitives. And when a small script at hand is tightly related to some OS thing anyway, it’s not a disservice to write it in shell.
csmantle 11 hours ago||
Python's main distinction from a shell scripting language is that external program invocations are not first-class citizen. Also no easy ways to feed/read the subprocess's std io.
wpm 4 hours ago||
Coming from the shell, one of the most annoying things about Python is working with files. In the shell I can read and write to files on the filesystem with basically no friction and no extra infrastructure. Just a "cat" command or a <, >, or >>. The ease at which input and output can just get tossed around in the shell is the biggest thing I end up missing when I graduate up to any "real" language.

I remember when I first learned how to work with files in Python and thought "Damn, y'all live like this?"

timeon 1 day ago|||
It is not just about scripting but the structure of input and output. Also no need to give up (z)sh switching shells is eazy.
BadBadJellyBean 1 day ago||
Maybe I need to get into nushell more but my feeling is that if it's a simple problem it the benefit will be negligible and if it is too complicated for that I will probably write a python script.
mbirth 20 hours ago|||
That was my feeling as well. Why learn some not-used-anywhere-else scripting language when we have bash/zsh with battle tested scripts and snippets? Also, nushell will probably break everything that expects a normal bash/zsh/fish.

I’d probably rather use xonsh as I do more complex scripts in Python anyways.

xpe 22 hours ago|||
That is how I felt with Zsh, even though Zsh scripting is a step up from Bash. But with Nushell there is a huge space of scripts I now prefer to write in it.
BadBadJellyBean 12 hours ago||
I use zsh because of oh-my-zsh. I don't any of the scripting features.
xpe 22 hours ago||
We all know the dueling aphorisms of "if it ain't broke, don't fix it" versus "no risk, no reward", so I'll just say this: there is a middle way. I keep a whole lotta Zsh and Bash scripts. But for work on systems I control, Nushell is a boon. I use it for interactive work and add scripts when I see a need.
maxloh 1 day ago||
Nushell commands are really great, so great that they are even better than the standard library of some languages. However, the language itself isn't very intuitive to learn.

I wish Nushell and Python/TypeScript have a baby one day.

bflesch 1 day ago||
> I wish Nushell and Python/TypeScript have a baby one day.

That would be nice. Or a TypeScript transpiler to rust ;)

Barrin92 1 day ago||
well if you want a python/shell hybrid there's always xonsh (https://xon.sh/). Really great in particular for people like me who are bash-challenged. I do like Nushell too but I also always had problems remembering the actual language.
maxloh 23 hours ago||
I actually meant something like that with Nushell commands. They output structured data that Python and JavaScript can easily leverage in theory.

  C: > ls
  ╭────┬────────────────────────┬─────────┬─────────┬──────────────╮
  │  # │          name          │  type   │  size   │   modified   │
  ├────┼────────────────────────┼─────────┼─────────┼──────────────┤
  │  0 │ Program Files          │ dir     │  8.1 kB │ 2 hours ago  │
  │  1 │ Program Files (x86)    │ dir     │  8.1 kB │ 2 months ago │
  │  2 │ Users                  │ dir     │  4.0 kB │ 4 months ago │
  │  3 │ Windows                │ dir     │ 16.3 kB │ 4 days ago   │
  ╰────┴────────────────────────┴─────────┴─────────┴──────────────╯
acedTrex 1 day ago||
I really wanted to get into nushell but i found reedline to be very limiting in a few specific ways esp around keybindings that blocked me from moving to it
cassepipe 1 day ago|
Anyone knows how good is the vi mode ?
fainpul 1 day ago||
My pet peeve with nushell: broken tables

https://github.com/nushell/nushell/issues/13601

https://github.com/nushell/nushell/issues/16379

absoluteunit1 14 hours ago||
This is the second time I’m hearing of Nushell.

I wanted to try it the first time I heard about it but completely slipped my mind so this is a good reminder.

Sunscratch 22 hours ago|
I’ve created a small utility script at work that automates some routine tasks and nicely formats the collected data in a table, and I can say that Nushell is an amazing tool.
More comments...