Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

211–220 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#211

Earlier quoted context omitted.

I guess I was more curious about the cost/benefit. Given a well defined standard like POSIX, and the difficulty of swapping in a new shell into Windows, I wasn't seeing why you'd buck the well established trend.

On windows a command interpreter is just a console application like any other console application, you just run and use it, no "swapping" involved.

So is Unix.

xterm -e /usr/games/nethack

xterm -e /bin/sh

Re: Nushell: Introduction to a new kind of shell

#212
post #200
post #188

Please correct me if I'm wrong, but doesn't nushell suffer from the same problem as powershell that all the nice fancy stuff works only for in-process commands and external programs are bit of a second-class citizens? To me interesting question is that is it even possible to build rich strucure-aware shell-like cli environment that would allow seamless integration of external polyglot programs in the same vein as uni…

nushell seems to have better way of parsing the string-only outputs of other commands. https://www.nushell.sh/book/commands/parse.html I don't know how to do a similar thing in powershell. > To me interesting question is that is it even possible to build rich strucure-aware shell-like cli environment that would allow seamless integration of external polyglot programs... Problem is that most of the classic Unix progra…

Powershell Select-String has the thing similar to nu's parse. See https://devblogs.microsoft.com/powershell/parsing-text-with-...

There is also very powerfull ConvertFrom-StringData

https://learn.microsoft.com/en-us/powershell/module/microsof...

Re: Nushell: Introduction to a new kind of shell

#213
post #209

Earlier quoted context omitted.

Bash is not the best we can do! If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable. There is also the Oil shell, whose creator often posts o…

>If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out PERL. Sh, awk, sed and mini-C all at once.

I tried to like Perl. I really really did. `while ()` and regex literals are amazing. Everything else is kind of rough for me, especially the way arrays and hash tables work, and I much prefer Zsh, AWK, or Python for the same niche.

Re: Nushell: Introduction to a new kind of shell

#214

Earlier quoted context omitted.

Bash is not the best we can do! If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable. There is also the Oil shell, whose creator often posts o…

I would recommend Oil! http://www.oilshell.org/release/latest/doc/idioms.html It removes the need to quote every variable, and this is fantastic

FWIW this is also the main selling point of Zsh. I should go through this document in detail (thank you for linking it!) but a quick search shows that Zsh is not mentioned even once, and I think a Zsh comparison would be really valuable for people like me.

Or is it like Neovim vs. Emacs at that point, where neither one is "better" and it's just a matter of taste and/or whichever one you happened to try first?

Re: Nushell: Introduction to a new kind of shell

#215

Earlier quoted context omitted.

> I may never write a bash script again I wrote 2x 200 line-ish shell scripts recently, and it was simply terrible, and although I'm increasingly convinced we need a shell like abstraction, I can't believe `bash` is the best we can do. Really hope I find one of these alt shells that suits me. Not a fan of Python but xonsh looks really cool too.

Bash is not the best we can do! If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable. There is also the Oil shell, whose creator often posts o…

I find the lack of string interpolation to be the one thing that kills me about javascript. The lack of it feels wrong and I can't get behind languages that don't have easy interpolation.

Yes Ruby has ruined me.

Re: Nushell: Introduction to a new kind of shell

#216

Earlier quoted context omitted.

Bash is not the best we can do! If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable. There is also the Oil shell, whose creator often posts o…

I find the lack of string interpolation to be the one thing that kills me about javascript. The lack of it feels wrong and I can't get behind languages that don't have easy interpolation. Yes Ruby has ruined me.

  `template${Math.random() > 0.5 ? 'strings' : 'literals'} have beern part of the language since 2015!`

Re: Nushell: Introduction to a new kind of shell

#217

I just ported a bunch of scripts to nushell. I hit some bugs, a couple of which are a bit sharp, but wow, the list of quirks I have to remember for nutshell are so much fewer than for bash. Constantly impressed at the errors it catches at parse time, kinda crazy sometimes. Oh my god I could cry, strings are sane to work with. I may never write a bash script again (it's okay, I use Nix so I get nushell everywhere I'm…

I learned PowerShell some time ago. I really like the concept and the power that comes with it. But, coming from Bash, I can't get a grip of the syntax. I am in the process of switching most of my shell scripts over to Python; I wonder whether nushell would be the better option.

You are absolutely not alone with this. There appears to be so much power so much potential, but it /feels/ so awkward syntactically.

Re: Nushell: Introduction to a new kind of shell

#218

Earlier quoted context omitted.

I wanted to like Powershell, but it is missing some features that I think are essential. For example, apparently checking the return status of an arbitrary command is not trivial, and there's no equivalent of `-eu -o pipefail`. Yes, I know `-eu -o pipefail` is imperfect too, but it covers most common cases. I also struggled badly to stop it from mangling the output encoding of my applications (no, I don't want a godd…

The upcoming 7.3 release had PSNativeCommandErrorActionPreference which was an experimental feature to implement pipefail https://learn.microsoft.com/en-us/powershell/scripting/learn... . It is no longer experimental and will be part of the actual release. This allows you to set `$PSNativeCommandUseErrorActionPreference = $true` rather than rely on `$ErrorActionPreference = 'Stop'` which does more than just treat non…

Oh, that is awesome. Finally.

Re: Nushell: Introduction to a new kind of shell

#219

> In a nutshell, nushell is non-POSIX shell, so most of your regular shells knowledge (zsh, bash, ksh, etc…) can't be applied on it, and using it feels like doing functional programming. Is there a reason some shells like fish (and now nushell) are non-POSIX? What is the benefit? I really like fish but I've kept away from it because it's non-POSIX and won't necessarily play well with years of POSIX scripts and knowle…

Because POSIX shell syntax is an unreadable and dangerous mess.

Re: Nushell: Introduction to a new kind of shell

#220

Earlier quoted context omitted.

it is the correct path for application data. Configs go in ~/.config on Linux, ~/Library/Application Support on Mac, and ~\AppData\Roaming on Windows; some other tools doing the wrong thing isn't a reason for nushell to do the wrong thing, and your preference for nushell doing the wrong thing shouldn't mean I have to suffer it. If you want it to be visible in your home dir, you can easily put a symlink there.

When you work on multiple OSes (mainly macOS and Linux), having your dot files normalized is IMHO the best experience, yes, I have symlinked, but if I need to setup a new mac (that does not happen often) then I could forgot about it and will take an extra step to setup, as I said that's just my preference. Also I want to say that the ~/Library/Application Support directory only works good for desktop app, so it's eas…

iterm2 puts config in ~/.config, while also having a directory in ~/Library/Application\ Support/ (habit). The author of iTerm has more credibility than the person you're replying to imho.

If a program is putting text files a user is supposed to edit in that directory, that's a mistake. If the application doesn't live in ~/Applications and provide a GUI for editing configuration, the file belongs in ~/.config and the app should follow XDG standards in general.

Post reply on HN