Earlier quoted context omitted.
Honestly I’ve enjoyed working with PowerShell for scripts to work for all developers on my team regardless of what OS they are using.
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…
Nushell: Introduction to a new kind of shell
171–180 of 252 posts
Re: Nushell: Introduction to a new kind of shell
#172Nushell is PowerShell done right.
What are the features that are done differently, or in other words, why would I choose Nushell over PowerShell?
PowerShell has a _lot_ of baggage. I don't like a lot of their design decisions (ex: the super verbose naming, the continue-on-error default that makes scripting a pain), and it's unlikely that those decisions will ever be revisited.
I tried pretty seriously to use PowerShell as my daily driver on Linux and macOS 2 years ago and was disappointed. Too many rough edges and Windows-first features.
PowerShell's startup performance is also pretty rough; I was seeing startup times around 2s after some minor profile customization.
I think Nushell addresses all of those points well; it's got nice concise syntax, solid support for Mac/Windows/Linux, and instant startup times. On the other hand, Nushell's less polished+stable than PowerShell; we're still making breaking changes to the syntax+commands.
Re: Nushell: Introduction to a new kind of shell
#173Having written a lot of shell scripts, the single greatest thing I've ever experienced is shell-friendly outputs. For example, consider if ls had a "--shell" option that output each entry as a single line of shell-quoted variables safe for eval: # cd /usr/share/dict # ls --shell words path="/usr/share/dict" file="words" user="root" group="root" size=985084 ... Then all sorts of things become easy. # eval $(ls --shell…
Wouldn't 'find .. -exec ' and friends get you this? find . -type f -depth 1 -exec ls -la {} + | awk {'print "file="$9 " user=" $3 " group=" $4 " size=" $5'}
| awk 'function esc(str) {
...
}
{ print "file=\"" esc($9) " user=\"" ... }'Re: Nushell: Introduction to a new kind of shell
#174Earlier quoted context omitted.
Why use this over PowerShell for example?
Some reasons I prefer Nushell over PowerShell: - less verbose syntax - better cross-platform support (PowerShell is technically cross-platform, but it has some baggage from its Windows-first history) - way faster to start up I'm a little biased (I'm a member of the Nushell core team), but those are all things that drew me to start contributing to Nushell. On the other hand, Nushell is certainly less mature+stable tha…
Re: Nushell: Introduction to a new kind of shell
#175I 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…
Yeah, this is a very fair criticism. We're working on it :)
Re: Nushell: Introduction to a new kind of shell
#176Does anyone have an ELI5 for what this, BASH, ZSH, Powershell etc do? It seems it's a conflation of #1: A CLI. #2: A specialized programming language that mainly does file-system operations. Is there a compelling reason to use something like this (or Powershell's scripting system, from the comments here), vice Python or Rust's etc standard library filesystem tools? Context: I use Windows Terminal with embedded powers…
If you’re using Windows Terminal, you’re using a sort of predecessor to Powershell (somebody please correct me on this), if you’re using terminal on Linux, you’re most likely using bash. Enter ps -p $$ at your Linux terminal to find out (which shell you’re using).
> Useful for compiling programs, running Python scripts, and executing CLI-based programs
Yeah, so from here, it’s possible to automate those commands, if you wanted to. In windows you’re talking about .Bat or .Ps1 files. Shells are the language you use to write those scripts, and they typically ship with access to some useful (file/text oriented) commands.
The only problem is these shells were invented in the 80s 90s, and have awful conventions that make some people miserable enough that they go and write a new shell that tosses previous conventions out the window. And IMO they did a great job.
Re: Nushell: Introduction to a new kind of shell
#177Does anyone have an ELI5 for what this, BASH, ZSH, Powershell etc do? It seems it's a conflation of #1: A CLI. #2: A specialized programming language that mainly does file-system operations. Is there a compelling reason to use something like this (or Powershell's scripting system, from the comments here), vice Python or Rust's etc standard library filesystem tools? Context: I use Windows Terminal with embedded powers…
- Terseness. I can very realistically type hundreds, if not thousands, of commands per day. Extra words or punctuation marks add up quickly.
- Shells are focused on executing things right now, as opposed to most other languages where the output is an abstract program to be run multiple times. This means using literals more often than variables, for example, which is why unquoted words in Bash are strings (except the first word of a command, because terseness is more important than consistency).
- They have more interactive features, such as warnings and prompts. Powershell detects if you're missing required params and prompts you one by one, for example.
- The purpose of a shell is to enable interactivity with OS primitives, be they Linux's files/processes or Windows' objects.
- Because most commands are typed interactively and only run once, glue code is especially painful and wasteful to write. So these languages pick a simple data structure for all function communication, and stick with it (e.g. Powershell's typed objects, Bash's newline separated strings, Lua's everything-is-a-table).
- Quality-of-life features. For example, Bash aliases (e.g. `alias wget='wget -c '`) are a pretty good idea that is non-trivial in other programming languages.
- Easy to plug stuff into other stuff. I don't mean just piping, but also things like temporary files via Bash's process substitution `<()`.
Re: Nushell: Introduction to a new kind of shell
#178Earlier quoted context omitted.
Some reasons I prefer Nushell over PowerShell: - less verbose syntax - better cross-platform support (PowerShell is technically cross-platform, but it has some baggage from its Windows-first history) - way faster to start up I'm a little biased (I'm a member of the Nushell core team), but those are all things that drew me to start contributing to Nushell. On the other hand, Nushell is certainly less mature+stable tha…
Something I've been curious about - are there any plans to sink serious effort into massively expanding the stdlib? Powershell's syntax and object-orientation I could take or leave, but access to the entire .NET Framework is pretty hard to beat, and the same draw exists for xonsh. Nushell is neat but there just aren't enough builtins.
What kinds of features are you looking for in the stdlib?
Re: Nushell: Introduction to a new kind of shell
#179One 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…
Re: Nushell: Introduction to a new kind of shell
#180Does anyone have an ELI5 for what this, BASH, ZSH, Powershell etc do? It seems it's a conflation of #1: A CLI. #2: A specialized programming language that mainly does file-system operations. Is there a compelling reason to use something like this (or Powershell's scripting system, from the comments here), vice Python or Rust's etc standard library filesystem tools? Context: I use Windows Terminal with embedded powers…
A shell is pretty much what you described. More accurately it’s a program for interacting with the operating system, and it usually ships with a scripting language, and Utility programs. Hence the conflation. If you’re using Windows Terminal, you’re using a sort of predecessor to Powershell (somebody please correct me on this), if you’re using terminal on Linux, you’re most likely using bash. Enter ps -p $$ at your L…
Not necessarily. Windows Terminal is just a terminal emulator; you can run any shell in it: cmd.exe, PowerShell, Nushell, bash, fish...