News for hackers. Stuff that matters.
Re:Introducing nushell by munchbunny on Friday August 23, 2019 @07:58PM (#20784047)
You can also just use PowerShell. Its chief crime is its verbosity in naming, but it has the "universally available consistent structured output for the CLI" you're asking for.
Re:Introducing nushell by addicted on Friday August 23, 2019 @09:50PM (#20784637)
I spent a lot of time in Powershell on Windows. Almost 3-4 years. I simply could not use it as a shell.

I enjoyed converting our many build scripts into Powershell, but using it as a shell was just uncomfortable.

It's not clear to me why. If I had to guess, besides the verbosity, it was the additional "indirection". Nothing was what it appeared on the screen. It was something else.

Bash felt far more comfortable as a daily shell because what you see is what you get.

I want to try Nu because it appears to combine that WYSIWYG simplicity of bash with the Powershell quality of passing data rather than text. Maybe tables are indeed a better data structure to use than objects.

Re:Introducing nushell by munchbunny on Friday August 23, 2019 @10:17PM (#20784767)
PowerShell is more like interactive Python with very smart tab completion than "bash with objects." Basic conveniences like "grep" require some memorized scripting gymnastics because the commands got generalized a little too much.

For regular shell usage it's a bit painful because the abstractions are a bit too far removed from the file system you're operating on. But for scripting, such as managing and configuring systems, it's remarkably fluid.

The "nothing is as it appears" problem never bothered me much because it's still just data. You just specify the output when you're done crunching it. IMO being able to operate with typed data is really nice because you don't have to worry (nearly as much) about serialization between commands.

Re:Introducing nushell by felixfbecker on Saturday August 24, 2019 @04:54AM (#20786059)
This is not true. If you want, you can literally pipe PowerShell output into grep (or select-string, which does the same) and it will filter by the tabular representation of each row. That can work just fine in interactive use cases and while it is less accurate and performant, it is the same bash.

The key to success in using PowerShell as an interactive shell is to memorize aliases and not caring about casing and spelling everything out. PowerShell is case-insensitive, has aliases (e.g. ? instead of where-object, or % foo to get the foo property of every object) and will accept abbreviated command and parameter names if the abbreviation is unambiguous. It is also useful to know about the different formatting cmdlets: mostly format-table (ft), format-list (fl), and that you can pick properties with -p (-Property). While PowerShell usually does the right thing, with these you can get the most appropriate formatting for any use case.

Re:Introducing nushell by hyperpallium on Saturday August 24, 2019 @01:33AM (#20785435)
(Disclaimer: never used powershell, so unadulterated opinion here)

Scripting is programming, so you want data structures. For interaction, you want human-readable syntax.

e.g. programming languages mostly have a syntax: C, python, bash, fortran (exception: lisp), but they operate on data structures.

We can see powershell, nushell and other structured shells (e.g. some use XML) as an attempt to "get out of the syntax business", which XML began and JSON finished (https://blog.mlab.com/2011/03/why-is-json-so-popular-develop...).

This has been taken further into human read/write domains... with mixed reception: ant, XSLT, json as a config format. After all, parsing and "the syntax business" has a practical purpose.

Re:Introducing nushell by 0x445442 on Saturday August 24, 2019 @10:21AM (#20787266)
> It's not clear to me why

I commented on this earlier but the defectiveness of PS as a shell hit me almost immediately when I tried to recreate my workflow of 'dirs -v', pushd and popd with a large number of paths on the stack.

Re:Introducing nushell by travbrack on Friday August 23, 2019 @09:03PM (#20784439)
Is it actually useful outside Windows? I know the latest version is now portable because of .net core, but I haven't tried it on *nix.
Re:Introducing nushell by felixfbecker on Saturday August 24, 2019 @04:56AM (#20786067)
Yeah I'm using it as my primary shell on macOS. You can do everything you do with bash, but with objects, autocompletion etc
Re:Introducing nushell by vips7L on Saturday August 24, 2019 @10:23AM (#20787286)
The only thing I cant find in PS is fishlike predictability when using it as a shell.
Re:Introducing nushell by travbrack on Saturday August 24, 2019 @01:06PM (#20788315)
Fascinating. Is there a command for getting processes for example or do you need to use ps?
Re:Introducing nushell by pitaj on Friday August 23, 2019 @08:54PM (#20784373)
Naw its chief crime is not having `&&`
Re:Introducing nushell by samstave on Friday August 23, 2019 @09:04PM (#20784441)
Im speaking from a position of naivete, so dont attack me;

Would an ideal situation be “do + while”

Whereas one may write

While x is true do “blah blah” && if output is still true then end elif do &&?

Or is that basically how it already works and we just have shitty interactions with the machines to get them too do the above (unless youre a more seniorbash person ((its one of my career regrets that i didnt spend a ton of time bash scripting)))

Re:Introducing nushell by pitaj on Friday August 23, 2019 @10:03PM (#20784715)
There are ways around it but nothing as easy as `&&` in other shells
Re:Introducing nushell by nailer on Saturday August 24, 2019 @03:36AM (#20785844)
pwsh 7 is adding it
Re:Introducing nushell by jen20 on Saturday August 31, 2019 @07:29AM (#20845701)
The chief crime of PowerShell is actually how long it takes for a prompt to appear after starting it - especially on Windows. I still use it as a login shell on MacOS because it offers useful features, but it's (to put it bluntly) slow as hell to start.