Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

71–80 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#71

> 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…

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.

Re: Nushell: Introduction to a new kind of shell

#72
post #69

One issue I have with nushell is that on macOS they use the `Library/Application Support` path for the config instead of the `.config` making it awkward, their reason is that the former is the correct path of application data, while none of the other CLI apps I use do this, every other app just points to the `$HOME` dir or `.config` dir. I used it for a while but I switched back to zsh, maybe in the future when it ha…

surely something as basic as the location of the config folder can somehow be changed to a custom path, right?

Configuring where configuration data lives can be tricky. (Chicken/egg problem.)

But you can certainly create your own symlink.

Re: Nushell: Introduction to a new kind of shell

#73

>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)

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.

Re: Nushell: Introduction to a new kind of shell

#75

>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)

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

[deleted]

Re: Nushell: Introduction to a new kind of shell

#76

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…

When PS has pushd, popd and dirs -v I’ll switch.

It has Push-Location and Pop-Location, which are aliased to pushd and popd. IDK about dirs -v.

Re: Nushell: Introduction to a new kind of shell

#77
post #51

Earlier quoted context omitted.

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

>Why? Case insensitive, weird parameter passing, no Posix-like interface. >Windows, macOS, and Linux Yet it is still mostly suitable for Windows, where it makes sense with weird (read: mostly bad and outdated) platform-wide proprietary decisions. >This is by design Well, humans should not spend too much focus on verbosity, maybe I'm wrong, at least that's what I've learnt from a university HCI course.

> Case insensitive, weird parameter passing, no Posix-like interface

Parameters are passed like any other shell?

> Well, humans should not spend too much focus on verbosity, maybe I'm wrong, at least that's what I've learnt from a university HCI course.

While its by design everything comes aliased and arguments are fuzzy matched. As a human you don't need to spend time on verbosity if you don't want to.

For example:

   Remove-Item $directory -Recurse -Force

   rm $directory -r -fo

Re: Nushell: Introduction to a new kind of shell

#78

>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)

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

OP here wrote this the most verbose way I could think possible. Most commands are pre-aliased in PowerShell and arguments are fuzzy matched as long as they're not ambiguous.

For example:

   Remove-Item $directory -Recurse -Force
   rm $directory -r -fo

For this specific example ConvertFrom-Yaml actually doesn't exist as a standard cmdlet and ConvertTo-Json isn't aliased by default:

    gc ./something.yml | ConvertFrom-Yaml | ConvertTo-Json > /some/file.json

Re: Nushell: Introduction to a new kind of shell

#79

>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)

With any shell:

    $ brew install yq
    $ yq -o json . 

Re: Nushell: Introduction to a new kind of shell

#80
post #70

Earlier quoted context omitted.

It's literally a subsystem. It's integrated in many ways you would not use to describe a "VM". I don't understand the aversion nor the confusion.

Here’s an example: if I build a Python app with PyInsyaller (which can’t cross-compile), and if I want a Windows executable, I have to build on Windows, not WSL, which defeats the whole purpose of “bash on Windows” because now at best I have to use Cygwin or Powershell or something and deal with a completely different environment.

You can run windows programs from whatever Linux shell (in WSL) you want, because the Windows filesystem is mounted and Windows executables run in the Windows environment.

OTOH, if you are doing anything complicated, it gets weird because (e.g.) file paths have to be passed as windows paths to windows programs, not using the linux mount path that you would access the path from in linux. But, you can, in principle, use a Linux shell in WSL to run Windows PyInstaller to build for Windows.

Post reply on HN