Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

101–110 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#101

Earlier quoted context omitted.

Is there a reason some shells like fish (and now nushell) are non-POSIX? Some things are different than other things. It's the same reason that not all desserts are pie, and not all automobiles are trucks.

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.

fish = "friendly INTERACTIVE shell"

Fish is my daily driver. I use it because it makes things I do regularly either easier, more memorable, or less error prone.

The primary use for fish is not scripting, afaik.

From a quick glance, nushell, like powershell, is strong working with pipelines of not-just-text data. That's better for your scripting/automation needs.

[Rant: Afaik, POSIX standardized what people did and agreed on at one point in time, warts and all.

For example, whitespace is a nightmare... in sh, var=$value vs var="$value", look at warts like "$@" and the ever-present annoyance of handling of paths with whitespace. I'm not even going to go look to see what of these are mandated by POSIX. Multi-OS scripts are different, doing something like Oil (oilshell.org) or PowerShell makes a lot of sense... ]

Re: Nushell: Introduction to a new kind of shell

#102
post #67

Earlier quoted context omitted.

I am a C# programmer at heart, and I use powershell a good bit. I can honestly say I can never use powershell without my cheat sheets or my list of favorite commands (and especially the arguments to use). I looked at this and kinda get it and think I could do some things with it. I don't think it's as powerful and can _definitely_ say it won't be capable of the same automations we use. That said, the text parsing peo…

Do you use pwsh as your daily driver? I find that its commands are as easily memorable as any other shell. That being said You should enable these: Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete Set-PSReadLineOption -PredictionSource History MenuComplete will give you a menu of arguments that each command takes so you can easily see them when pressing tab for completions and prediction source will try to pr…

Also make sure you're on latest version of PSReadLine (I had some problems with it not updating properly and had to do a manual `Install-Module PSReadLine -Force`) and try

  Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
You can also toggle between the default inline and listview with F2. Also if you install

  Install-Module CompletionPredictor
and add this to your profile:

  Import-Module -Name CompletionPredictor
  Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
you also get the normal intellisense autocompletions in the listview. And remember that if you have all the help files installed locally you can use F1 to view help for the current parameter/command.

Re: Nushell: Introduction to a new kind of shell

#104

>This is just an example from YAML to JSON, but you can convert much more formats into other formats. >open dev/home-impermanence/tests/impermanence.yml | to json I can do it with PowerShell: $os_list = (Get-Content -Path "C:\temp\operating-systems.yml" | ConvertFrom-Yaml) Set-Content -Path "C:\temp\PowerShell_operating-systems.json" -Value ($os_list | ConvertTo-Json)

I mean, yeah? As much as I hate to admit it (and believe me, I hate to admit it), PowerShell is better than bash at composing tools made by all sorts of people on the fly in easy to write pipelines. I have my issues with it as a language, but it's not like I'm thrilled to write bash. Nushell is an attempt at making a scripting language which builds on bash, rather than supplanting it. PowerShell is much less nice on Linux, especially when you'd have to translate every existing resource.

Re: Nushell: Introduction to a new kind of shell

#105
post #90

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…

Honestly I’ve enjoyed working with PowerShell for scripts to work for all developers on my team regardless of what OS they are using.

yep been using powershell here too..great stuff

Re: Nushell: Introduction to a new kind of shell

#106

Earlier quoted context omitted.

> PowerShell's huge deviance from the rest of the POSIX-y world doesn't help In PowerShell (on Windows), `rm` is an alias to `Remove-Item`[0]. Therefore, rm -r -fo An extra dash, extra space, and extra letter isn't too bad by my books. Furthermore, in scripts, aliases are discouraged by PSScriptAnalyzer[1]; IDEs (PowerShell ISE, VS Code PowerShell extension) also support code completion, so: Remove-Item -Recurse -For…

why do they alias all this stuff. Remove Item is _not_ rm. It's so stupid. Like when they aliased wget and curl to some nonsense web request command and everybody complained that it didn't work. I'll never use PowerShell. Just way too many bad decisions all over the place.

>why do they alias all this stuff

To make interactive usage easier? PowerShell essentially replaces the text-oriented environment provided by coreutils with an integrated object-oriented one.

Re: Nushell: Introduction to a new kind of shell

#107
post #35

Earlier quoted context omitted.

Powershell is also quite anti-semantic, non-portable and verbose

> anti-semantic Why? > non-portable PowerShell 6 and later run on Windows, macOS, and Linux. > verbose This is by design.

> > anti-semantic > Why? I can't speak to the other poster, but I found the PowerShell example to misleading because it required the presence of a variable that the Nushell did not. I had to read through the code three times to understand:

- Whether the code was modifying some fundamental environment variable that would affect the running of other programs? - If the variable would need to be accessed after the command was run? - Why the variable was named `os_list`? This was admittedly stupidity on my part, but it wasn't event a concern with Nushell.

> > non-portable > PowerShell 6 and later run on Windows, macOS, and Linux.

PowerShell is absolutely multi-platform and that should never be held against it. However, my personal experience has been that most PowerShell guides assume that you are running Windows and will attempt to call commands not available on other platforms (e.g. OS services, other applications). Granted, scripting tutorials for Linux and OSX also assume the presence of certain services, though it's easier to search my path for `7z` than figure out whether the Get-Acme-Version command is available. Nonetheless, the issue is more of documentation than implementation.

> > verbose > This is by design

As for the verbosity, I'll fully agree that PowerShell is highly verbose by design. However, that's a design decision that makes it inappropriate for some applications. An aircraft carrier is larger than a kayak "by design", but that doesn't make it any easier to strap to the top of your car.

Re: Nushell: Introduction to a new kind of shell

#108

Earlier quoted context omitted.

That is a great example, but for different reasons. I think PowerShell is amazing, but it never feels like something I want to work in as a shell. Writing scripts in an IDE, sure. But to convert some yaml to json I’d much rather type open/file.yml | to json

This is where I’m at with PS as well. It’s stuck in this no man’s land between bash and python. It’s a better scripting language than bash and a better shell than python. But when compared to their main purposes it’s a worse shell than bash and a worse scripting language than python. The caveat of course is Windows system administration. I’m sure it’s excellent in that domain.

I end up using C# as a scripting language, the GUI on Windows, and ZSH on Linux Servers…

Re: Nushell: Introduction to a new kind of shell

#109
I tried nushell for a few days, but sh syntax is just too ingrained... It slowed me down a bunch and couldn't get over the initial learning curve. Ended up going back to zsh. Also, losing a bunch of completions for tools I used was a bummer. I wish nushell could parse bash/zsh completion scripts or something to help ease the transition.

Maybe I'll revisit it at some point in the future.

Re: Nushell: Introduction to a new kind of shell

#110

Earlier quoted context omitted.

> anti-semantic Why? > non-portable PowerShell 6 and later run on Windows, macOS, and Linux. > verbose This is by design.

Lol so what happens if I run 'curl' in my PS6 script? Asking for a friend with PTSD.

Assuming you have curl installed, it'll say

  curl: try 'curl --help' for more information
I assume you're thinking of the old Windows PowerShell that used to have curl/wget aliased to it's own commands, but that's not the case with the new cross-platform PowerShell.
Post reply on HN