News for hackers. Stuff that matters.
Re:GitHub – nushell/nushell: A new type of shell by hyperpallium2 on Wednesday June 16, 2021 @02:28AM (#27525490)
Need some description up front, not in the 5th section ("Philosophy" https://github.com/nushell/nushell#philosophy). Some ideas:

"powershell for unix", "structured pipes", "pre-parsed text", "small, useful, typed tools loosely coupled."

Re:GitHub – nushell/nushell: A new type of shell by jupp0r on Wednesday June 16, 2021 @02:45AM (#27525594)
Re:GitHub – nushell/nushell: A new type of shell by j1elo on Wednesday June 16, 2021 @04:17AM (#27526147)
Am I missing something cool by not looking into PowerShell for Linux? Anyone using it could chime in and share how it improves their workflow? What kind of tools does it bring to the table?
Re:GitHub – nushell/nushell: A new type of shell by torginus on Wednesday June 16, 2021 @07:55AM (#27527491)
Disclaimer: I use PowerShell on Windows, I've never tried it on Linux, but I don't see why its advantages wouldn't transfer. That being said, I think it's main advantages are:

- Typed object streams, which gives you stuff like autocomplete, IDE support, and generally there's no need to muck about with sed/awk/xargs - Very fast, it's absolutely fine to read a file line by line, and parse it in a script, whereas doing the same in bash/awk is a ton slower than clever use of cat/grep/wc (and a myriad of other tools) - Due to type information being retained, it's a lot easier to figure out what a given script does, without having to know how the output of a given tool looks like, given it's particular command line switches.

This is just my opinion, but PowerShell is a lot more geared toward people like me, who only write a script once in a blue moon/muck about with the build scripts occasionally, while Bash is more geared toward veteran sysadmins who live and breathe this stuff.

Re:GitHub – nushell/nushell: A new type of shell by j1elo on Wednesday June 16, 2021 @08:42AM (#27527845)
Nice summary. It leaves me wonder, though: is the philosophy the same as in Unix world? as in, little independent tools that do one and just one thing. Would those tools also need to be modified to add compatibility with the same typing system that is used by the shell?

Or it follows the opposite mentality and the sell comes with batteries included?

I'm thinking of some arbitrary example, like downloading a JSON and parsing it to obtain some nested sub-property. In Bash world you would use the shell to execute at least something like `wget` to do the download part, and then run `jq` to parse the JSON and select the desired property. Both of `wget` and `jq` are independent programs, installed separately, with their own input & output channels, that you combine together by using the shell itself.

How would this work with PowerShell? (feel free to use some other example that might be better suited)

Re:GitHub – nushell/nushell: A new type of shell by naikrovek on Wednesday June 16, 2021 @09:14AM (#27528148)
Powershell commands (called "commandlets" or "cmdlets") are little .net (or .net core) programs/methods which accept and return either objects or arrays of objects, rather than plain text.

powershell offers cmdlets which let you sort and filter these result objects based on object property values rather than sorting on plain text values.

Obviously when printing to stdout or stderr, THAT bit is plain text, but until that very last step of displaying in the terminal, powershell results are objects.

So, that gives you a form of type safety, which isn't strictly possible in text-only shells. Powershell uses reflection to inspect the objects since the exact type of a response may have never been seen before. You can write your own cmdlets which return your own types and you can modify types returned by cmdlets using operators like 'select'. So, it's type-safe but not like everyone is used to. Powershell cmdlets always return objects (or errors, I guess), but the structure of those objects isn't always known until runtime. You can still use those never-before-seen types with the standard operators like sort and select, too.

Powershell also offers output conversion cmdlets which let you output to CSV or a textual table or a list, which is helpful when the next step in your pipe chain is a tool that expects textual input or a csv file. One can also write their own output formatters, of course.

In those ways, powershell and nushell appear to have the same goals. I haven't looked at nushell any more closely than it would take to notice this, so there may be other similarities I haven't noticed, yet. I'm sure there are many differences that I haven't noticed yet, as well.

Re:GitHub – nushell/nushell: A new type of shell by j1elo on Wednesday June 16, 2021 @10:49AM (#27529134)
Thank you very much, it's now clearer to me how it works.

Regarding the objects themselves, the way you describe them makes me think of Javascript objects & arrays: you don't need to know the exact shape of an input object, as long as it has the specific properties that you want to work on. Same for arrays: regardless of their content, the language allows you to use the standard ops like map() or find() (and it's then a matter of you providing adequate functions to access the contained elements)

Re:GitHub – nushell/nushell: A new type of shell by vips7L on Wednesday June 16, 2021 @09:13AM (#27528133)
In powershell you would use built ins.

To download json over rest you would use Invoke-RestMethod or irm.

To convert json to objects you would use ConvertFrom-Json.

To select properties from objects you would use Select-Object or select.

Here is a concrete example that I wrote for the rustlings install script: https://github.com/rust-lang/rustlings/blob/main/install.ps1...

Note that I used Invoke-WebRequest instead of irm here.

Re:GitHub – nushell/nushell: A new type of shell by d0mine on Saturday June 19, 2021 @04:52AM (#27558964)
It looks like: `curl <url> | jq .tag_name` Note: curl & jq are independent programs (as long as `curl` produce json text with tag_name in each, the command works, no matter other changes).

If ConvertFrom-Json & Select-Object were not builtin, how much information about each other would they need to cooperate? Can an unrelated change in ConvertFrom-Json's output break corresponding Select-Object command? How much are they intertangled?

Re:GitHub – nushell/nushell: A new type of shell by vips7L on Sunday June 20, 2021 @10:06PM (#27575594)
Curl to python is actually what happens in the Linux install script [0].

To your point, all cmdlets adhere to an interface so they always return and receive typed data. They don’t really need to know anything except that they’re receiving or giving powershell objects.

Non built in commands (native binaries) just pipe a stream of bytes just like any posix shell.

Re:GitHub – nushell/nushell: A new type of shell by bobalob_wtf on Saturday June 19, 2021 @09:49AM (#27560439)
ConvertFrom-Json converts json text into a PowerShell object with properties derived from the json.

Select-Object (in this instance) selects a property from the object.

An unrelated change in ConvertFrom-Json wouldn't change it's basic nature which is to convert json into something you can manipulate with other PowerShell cmdlets.

Re:GitHub – nushell/nushell: A new type of shell by j1elo on Wednesday June 16, 2021 @10:54AM (#27529184)
And then I guess the shell itself has mechanisms to easily attach or register new commandlets, to allow for easily add custom object processing?

I really like the consistency that those commands have: ConvertFrom-<ConverterFormat>.

No built in converter for the format you need? I'm just speculating here, but I guess you just need to implement this or that Interface and there you go.

Re:GitHub – nushell/nushell: A new type of shell by vips7L on Wednesday June 16, 2021 @11:55AM (#27529964)
Yes you can write your own cmdlets in either C# or powershell that you can install via modules [0]

You can also just write a function in your profile.

[0] https://docs.microsoft.com/en-us/powershell/scripting/develo...

Re:GitHub – nushell/nushell: A new type of shell by godtoldmetodoit on Wednesday June 16, 2021 @11:43AM (#27529821)
You can define your own function and use it in your pipeline yes. You can have your function take pipeline input just like the built in cmdlets.
Re:GitHub – nushell/nushell: A new type of shell by smackeyacky on Wednesday June 16, 2021 @04:45AM (#27526313)
I use it a bit on windows servers because it integrates well with other microsoft tools.

On linux...it seems both redundant and just plain weird for weirds sake. There are literally dozens of alternatives on linux that have a sane syntax and are likely preinstalled.

Re:GitHub – nushell/nushell: A new type of shell by yabones on Wednesday June 16, 2021 @08:33AM (#27527761)
Powershell is a pretty neat scripting language, especially if you manage Windows boxes or have lots of .net stuff around.

It's not a good interactive shell environment though. The commands are way too verbose and the syntax feels clunky for keying in.

Re:GitHub – nushell/nushell: A new type of shell by AnIdiotOnTheNet on Wednesday June 16, 2021 @09:24AM (#27528254)
I disagree. Yes, the syntax is verbose so that you get sensical names instead of things like 'awk' and 'grep', but that isn't a big deal because a) tab complete[0], and b) user-definable aliases.

[0] tab complete works on cmdlets, switches, and variables.

Re:GitHub – nushell/nushell: A new type of shell by Arnavion on Wednesday June 16, 2021 @02:59PM (#27532163)
And if one misses the short incomprehensible aliases, the common commandlets have those by default anyway. `cat` is `gc`, `grep` is `sls`, `ls` is `gci`, ...

Same for switches and parameters. You don't have to miss `rm -rf foo/`, it's just `ri -re -fo foo/`

Re:GitHub – nushell/nushell: A new type of shell by pxc on Thursday June 17, 2021 @12:34AM (#27536165)
I don't mind the verbosity at all, but PowerShell in my experience is painfully slow for interactive use, if you want the kind of niceness you can get with Fish, Zsh, or Elvish (fuzzy filtering, smart-case completion, any-order/substring completion, etc.).

The module system is also not great for distributing little configure snippets like Oh My Zsh or something, it's clunky and over-complicated for that.

Re:GitHub – nushell/nushell: A new type of shell by JadeNB on Wednesday June 16, 2021 @03:23PM (#27532392)
> [0] tab complete works on cmdlets, switches, and variables.

Isn't this how modern tab complete works everywhere? bash 5.1 (the shell I happen to be running right now, and which I mention because I think of its out-of-box tab completion as pretty basic) tab completes variables.

Re:GitHub – nushell/nushell: A new type of shell by Kipters on Wednesday June 16, 2021 @05:42AM (#27526635)
I don't use it as a shell on Linux/macOS (I don't think it's even really supported yet), but as a scripting environment it's been ok: the language is sane enough, you can use the .NET BCL if you need to and its behavior is consistent across platforms.

We use it for automation in our .NET codebase (which is being developed on both Windows and Linux) instead of bash scripts because of that and the fact it's preinstalled in the .NET SDK Docker images

Re:GitHub – nushell/nushell: A new type of shell by brushfoot on Wednesday June 16, 2021 @06:16AM (#27526824)
It's supported on Linux. It's one of the first packages I install on a fresh box lately.
Re:GitHub – nushell/nushell: A new type of shell by loulouxiv on Wednesday June 16, 2021 @05:56PM (#27533919)
What do you use it for generally ?
Re:GitHub – nushell/nushell: A new type of shell by brushfoot on Thursday June 17, 2021 @09:45AM (#27539486)
My default shell. Everything from manipulating XML to system administration. I'm a big fan of the object-based pipeline.

Quick examples:

- Accelerators for data and conversion tasks. For example, reading a file with `Get-Content` (or frequently in the shell, the alias `gc`) and parsing and converting into a traversable, queryable XML: `[xml]$myXml = gc my-file.xml`. Then you can go `$myXml.customers.firstName` or use an XPath query.

- To get the difference between two dates, `[DateTime]::Now - [DateTime]'2021-01-01'` returns a `TimeSpan` with the elapsed hours, days, etc. It parses the date string for you because of the `[DateTime]` before it.

- The cmdlets for system administration. For example, exporting processes that use more than 200 MB of RAM and their image paths to CSV: `Get-Process | where { $_.WorkingSet -gt 200000000 } | select ProcessName, Path | Export-Csv memory-hogs.csv`

Re:GitHub – nushell/nushell: A new type of shell by Tijdreiziger on Wednesday June 16, 2021 @11:21AM (#27529536)
I used PowerShell as my main shell for a few years (before WSL existed). My experience is that it's extremely tedious having to relearn every command 'the PowerShell way' if you already know your way around standard Unix commands (and I wasn't exactly a Unix guru either). When WSL dropped I switched and haven't looked back.

The only PowerShell tool I did love was posh-git [0]. Thankfully, someone has ported it to bash/zsh as posh-git-sh [1].

[0] https://github.com/dahlbyk/posh-git

[1] https://github.com/lyze/posh-git-sh

Re:GitHub – nushell/nushell: A new type of shell by e12e on Wednesday June 16, 2021 @06:04PM (#27533973)
I don't think so. Although, there seems to be small trend, especially with golang utilities - to shift from text toward json - or rather a "worst of both worlds" - docker is a prime example of this, eg:

  docker network inspect webservers -f '{{ range.Containers}}{{.IPv4Address}}{{end}}'
Once tools start down this path, I think powershell, or any shell built around primitives that work on tree structures, make more sense (ie: rather than cut, awk, grep-tools for printing named fields etc).

Must admit, I am no big fan of ps syntax - too verbose for interactive use - too unfriendly for scripting..

Re:GitHub – nushell/nushell: A new type of shell by tonyedgecombe on Wednesday June 16, 2021 @05:41AM (#27526629)
If you spend all day immersed in PowerShell on Windows then it might make sense to leverage that familiarity on Linux.

Also if you are managing Azure from Linux or macOS.

Re:GitHub – nushell/nushell: A new type of shell by Macha on Wednesday June 16, 2021 @07:03AM (#27527096)
Powershell has some interesting ideas about passing around objects rather than just text.

The unix way of text streams and tools to manipulate them are too ingrained that I haven't bothered to get in detail, but I hear some people are fans.

Re:GitHub – nushell/nushell: A new type of shell by anticodon on Wednesday June 16, 2021 @03:00AM (#27525683)
PowerShell from Microsoft is looking too alien on Unix. Just looking at the syntax I already feel uncomfortable.

It's hard for me to criticize it because I haven't used it, but it looks like it was designed by a committee and overdesigned. I.e. it wasn't created from the need, like someone at Microsoft wanted to automate his work and created PS to solve his problem. It looks like some boss decided: "They have shells, so we should have it also. But we will make it much cooler. So, let's gather a committee of 500 of our best managers and let's decide what features it should have".

It looks artificial and inconvenient to me unlike Unix shells. Maybe I'm wrong. But I'm pretty sure that even syntax of PS makes it harder to type the commands. Unix commands are very short (many are 2-4 letters long), all lowercase and do not contain characters which are hard to type (e.g. `-`).

Re:GitHub – nushell/nushell: A new type of shell by skissane on Wednesday June 16, 2021 @03:36AM (#27525908)
PowerShell was started by a single person, Microsoft's Jeffrey Snover. As the project progressed other designers came on board but Snover remained (and remains) as Chief Architect. The design-by-committee allegation isn't being fair to him.

Part of why PowerShell may seem not quite Unix-like, is Snover didn't just look at Unix as an influence. Snover's professional background included experience with IBM OS/400's CL shell and OpenVMS's DCL, and his experience with both systems influenced PowerShell's design.

Re:GitHub – nushell/nushell: A new type of shell by larodi on Wednesday June 16, 2021 @07:30AM (#27527287)
Once you start using PWSH, the design decisions are so obvious and make so much sense, that it is obvious Jeffrey Snover did have vast experience with variety of shells and languages.

The idea to tie it with .NET and COM+ on windows is the best a shell has ever done, though someone noted in another thread that it is an old idea from XEROX mainframes (not sure what the name was).

if you want to imagine this in terms of unix/linux - it would be something like having all libraries' APIs at disposal directly from a shell that passes structured objects. or python's REPL being more shell-usable or JVM having a shell that provides access to all classes in a click of ENTER.

major downside of pwsh is that you can feel it being slower than expected due to the way objects are passed around, but I really expect this will be solved at some point with future releases as PWSH as language is still being developed so some concepts and internal architecture decisions perhaps change a lot.

noshell is taking this idea to a fair level, but really, there is a reason to do some dev/devops work in PWSH because it will heavily impact all future shell development even if eventually superseded by something better.

Re:GitHub – nushell/nushell: A new type of shell by rkeene2 on Wednesday June 16, 2021 @08:27AM (#27527716)
If you want that same ability from bash, it's available [0]. However, it interacts with C FFI, so it's lower level.

[0] https://github.com/taviso/ctypes.sh

Re:GitHub – nushell/nushell: A new type of shell by larodi on Saturday June 19, 2021 @06:14AM (#27559291)
Sorry, but it's absolutely not the _same_ experience, but much harder and less integrated, Also let's not forget for a minute that bash tosses characters, and not objects.

There's a very long road for any shell to get where pwsh is within MS's ecosystem (and even within .NET Core/GNU ecosystem). And I can easily imagine .NET Core wrapping DBUS and other COM-like facilities available for GNU OSs.

Re:GitHub – nushell/nushell: A new type of shell by hyperpallium2 on Wednesday June 16, 2021 @09:42AM (#27528419)
BTW Jeffrey Snover said every PowerShell feature was supported by a business case. A principled approach, I thought, if mercenary.

But what's the "business case" for iteration, conditionals, addition - apart from "everyone needs these"? Though these probably weren't the features he was thinking of.

Re:GitHub – nushell/nushell: A new type of shell by IlliOnato on Wednesday June 16, 2021 @01:14PM (#27530941)
I don't think I understand the question.

You think iteration, conditionals, addition are not needed in shell scripts? It would be a very unusual position indeed.

Or could it be that you are not familiar with the expression "business case"? (Sorry if this is off base! but the word "mercenary"in your post also kind of points this way).

"Business case" has very little to do with business as commercial enterprise...

Re:GitHub – nushell/nushell: A new type of shell by AnIdiotOnTheNet on Wednesday June 16, 2021 @09:27AM (#27528276)
The only thing I can think of in PowerShell that definitely seems to be "design by committee" is the whole ScriptExecutionPolicy nonsense.
Re:GitHub – nushell/nushell: A new type of shell by kaba0 on Wednesday June 16, 2021 @03:21AM (#27525814)
I’m sorry to say this but this is a very uninformed comment with way too many biases without any backing.

> I.e. it wasn't created from the need, like someone at Microsoft wanted to automate his work and created PS to solve his problem

Interestingly enough, it is used for automating Windows configuration.

Re last paragraph:

UNIX commands are random letters that are like that due to historical reasons — if you don’t know one exists, you can’t find it. And when you have to use {} in PS you are dealing with something you would do with awk sed with even more arcane syntax — PS is pretty readable with some knowledge on any PL. Also, they are Verb-Noun based so you can get around and find commands even offline (though Noun-Verb would have probably been a better decision). Due to the fixed syntax they can be shortened very well. Also, due to every “command” having the same conventions, arguments are properly done (no tar xf or -xf or —extract), they are reliably autocompletable without black magic, and they are also autocompletable by giving enough letters to make it unambiguous. So while I am not particularly fond of Microsoft, powershell is better than bash (though frankly, what isn’t?) in every conceivable way.

Re:GitHub – nushell/nushell: A new type of shell by wokwokwok on Wednesday June 16, 2021 @04:03AM (#27526072)
> So while I am not particularly fond of Microsoft, powershell is better than bash (though frankly, what isn’t?) in every conceivable way.

There are fair criticisms to be made of bash...but this isn’t a fair comment either; I use power shell a lot; I’ve written hundreds or thousands of lines of powershell glue for scripts and devops pipelines and all kinds of things.

It’s not very good.

It is one of those things that seems like it’s a great idea; everything is an object, don’t serialise between jobs, tab completion on related objects, verb-noun commands... it reads like a feature matrix.

The reality is less ideal.

It’s verbose, the commands are arcane, and the verb-noun thing breaks down into meaningless pairs in many cases, particularly in the azure commands, or worse sql server commands.

Maybe, to be fair, there is a core of elegance in there, but powershell displays a fundamental failure:

When an application doesn’t have to do the hard work of making a good cli, the resulting commands in powershell are actively user hostile.

It’s a pattern I’ve seen over and over again; and things like the az-cli are a tangible acknowledgment from Microsoft itself that the results have been substandard, and rejected, overwhelming, by the broader community in favour of arguably inferior tools (eg bash).

So... you might argue “network effect”, but I don’t buy it; powershell isn’t friendly; not to new developers, not to “clicks ops” developers, not to Unix developers.

It’s firmly a middle ground “no one wants to use it if they can avoid it” product.

Bash scripts, now there is literally a hell on earth... but bash itself? Works fine.

/shrug

Re:GitHub – nushell/nushell: A new type of shell by brushfoot on Wednesday June 16, 2021 @06:43AM (#27526969)
> It’s firmly a middle ground “no one wants to use it if they can avoid it” product.

No way, I love PowerShell. It was my first choice for the bulk of a B2B Windows integration product. Part of it's a C# desktop app; the rest is PowerShell scripts that customers can edit to taste.

I reach for it all the time in projects. The pipeline is so clean to work with. Once you get used to how it handles collections, the cmdlets are very intuitive, and PowerShell Gallery has a large selection available for download.

Objects instead of strings is big by itself, of course. Then you get the .NET standard library right in the shell to interact with them. Great for parsing dates, numbers; a powerful regex engine; stream manipulation; pathing functions; the ability to write and execute C# in the shell; etc.

The cmdlets for data manipulation have gotten very good, too. The CSV cmdlets used to be unintuitive because they exported type data, but that's now off by default. `Import-Csv` and `Export-Csv` work with objects that you can easily manipulate with the set operations cmdlets. It feels very much like LINQ.

Same with `Invoke-RestMethod` (`irm`) when interacting with APIs. It deserializes JSON into objects automatically. You can then easily filter or transform the result.

There's a learning curve for sure, but once you get past that, it's a very good shell. I feel like it's one of the best things to come out of Microsoft.

Re:GitHub – nushell/nushell: A new type of shell by kaba0 on Wednesday June 16, 2021 @04:38AM (#27526271)
I didn’t mean that PS is the ideal shell, it has plenty of warts (I did mention the Verb-Noun thing), and bash’s syntax does have a good subset — namely piping, redirects to a certain degree. But variable substitution, not having proper math support, everything is text are terrible and they do come up with the arguably rare, more complex commands. Also, having a convention that has quite a few edge cases where it doesn’t work good may still be better than not having any. And the application not creating good cli is not shell-specific at all —- the linux world has it better because a good cli is prioritized. Even though git is often touted as having a terrible interface.
Re:GitHub – nushell/nushell: A new type of shell by unwind on Wednesday June 16, 2021 @06:49AM (#27527001)
This comment would make it into awesome-space, for me at least, if it had some examples of the issues you mention.
Re:GitHub – nushell/nushell: A new type of shell by anticodon on Wednesday June 16, 2021 @03:30AM (#27525864)
Yes, I haven't used PowerShell. And I agree that my comment is uninformed.

It's just that I feel uncomfortable even looking at the PS syntax. Maybe it's idiosyncratic. Maybe I've spent too many years in Unix shell.

Re:GitHub – nushell/nushell: A new type of shell by user-the-name on Wednesday June 16, 2021 @04:37AM (#27526261)
If somebody tried to introduce the Unix shell syntax today, they would be laughed out of the room. Nobody would be able to take something so utterly nonsensical seriously.

The only reason anyone accepts it is that it has always been there. But if you actually look at it critically, it is hot garbage.

Re:GitHub – nushell/nushell: A new type of shell by lc9er on Wednesday June 16, 2021 @08:48AM (#27527916)
Idiomatic Powershell is definitely verbose, but you get used to it (and you can disregard if you want). The verbosity can be used to make it more human readable, if done right. I use Powershell on a daily basis - the biggest thing that people have noted is passing objects, instead of text. At first it was weird, but now I find it really helpful. It makes it very easy to tie components together, without having to slice and dice text.

Another great feature is named parameter support. It's so much easier to deal with parameters than with other languages I've used.

Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @03:45AM (#27525969)
I've used it and I can relate to the comment. Maybe your assumptions are off in there, but I think the main point you were trying to make is that it's complicated. It's so complicated that you really need a repl to be able to work with it efficiently. It's a bit like how programming Java is simple if you do it in Idea or back then in eclipse, but in a pure editor it's impossible to remember all the boilerplate.
Re:GitHub – nushell/nushell: A new type of shell by kaba0 on Wednesday June 16, 2021 @03:51AM (#27525999)
Can you write a bash one-liner that gets the free memory of your system? Is the awk blackmagic better than selecting an item of an object? Of course new things will be harder to write but it’s a people problem not something inherent with PS.
Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @04:13AM (#27526124)
I find cut easier to use than remembering awk syntax. So I get where you're coming from, but it's just a tad disingenuous don't you think? Especially since `free` `man free` is definitely easier to remember than Get-Whateverfunctioncall is
Re:GitHub – nushell/nushell: A new type of shell by vips7L on Wednesday June 16, 2021 @08:01AM (#27527533)
Is it easier? Because I would expect man free to go to the C stdlib.h definition.

You’re just familiar with the former and not the latter currently.

Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @10:11AM (#27528666)
Your assumption is wrong. Why would you double down on a bad argument? Don't you have a linux environment to type man free in before making that claim?

It's just an overall bad argument. I don't see how `Get-CimInstance -Class Win32_OperatingSystem` is in any way memorable

https://www.google.com/search?q=man+free

Re:GitHub – nushell/nushell: A new type of shell by vips7L on Wednesday June 16, 2021 @02:58PM (#27532154)
How is expecting man free to point to the stdlib function a bad argument? man malloc goes to the function so why shouldn't man free? How would anyone just know that the command free exists _without already being familiar with a linux environment_ ?
Re:GitHub – nushell/nushell: A new type of shell by reallydontask on Wednesday June 16, 2021 @10:55AM (#27529200)
man free for me shows the BSD library functions manual, maybe it's different in Linux
Re:GitHub – nushell/nushell: A new type of shell by Arnavion on Wednesday June 16, 2021 @03:05PM (#27532214)
It's the same on Linux, depending on what manpages you have installed. free(1) is the binary. free(3) and free(3p) are the C function.

If you have more than one installed, `man` might decide to show the first one or it may interactively ask you to pick one, depending on whether it's been configured to be "posixly correct" or not.

Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @11:20PM (#27535838)
procps may not be installed by default on BSDs or VMS or whatever other *nix flavour the person has. But then again quite a few of those systems also don't use bash as default shell(or at least didn't use to), so when the person above asks about "writing a bash script to just do" it's safe to make some assumptions about the target audience.
Re:GitHub – nushell/nushell: A new type of shell by 411111111111111 on Wednesday June 16, 2021 @04:36AM (#27526251)
is the writing part really what we should focus on in scripting though?

i personally would've put much more weight into the ease of reading and understanding the code.

personally, i think that PS just came too late, so most people (me included) are too used to the way the unix shell works/feels. It would have to be just straight up better in all regards to displace it, but its more like a different flavor entirely. It however a very interesting take on scripting, in my mind it was more comparable to python repl then bash though, but i haven't really used it much.

Re:GitHub – nushell/nushell: A new type of shell by jamincan on Wednesday June 16, 2021 @08:46AM (#27527881)
I think bash is only readable because pretty much everyone is already familiar with the syntax. Given someone with no experience, they would probably have more success understanding what a Powershell script is doing.
Re:GitHub – nushell/nushell: A new type of shell by 411111111111111 on Wednesday June 16, 2021 @10:07AM (#27528627)
> personally, i think that PS just came too late, so most people (me included) are too used to the way the unix shell works/feels.

I'm getting confused here, Isn't that literally what I said?

Re:GitHub – nushell/nushell: A new type of shell by AnIdiotOnTheNet on Wednesday June 16, 2021 @09:31AM (#27528321)
Wait, are you seriously trying to tell me that bash is more readable than PowerShell? Excuse me, but what alternate timeline did you accidentally stumble in from?
Re:GitHub – nushell/nushell: A new type of shell by 411111111111111 on Wednesday June 16, 2021 @09:46AM (#27528457)
I did not say that, no.

I said that a lot of people (me included) are more used to Unix shell scripting. If PS had been released 30yrs ago, things wouldve probably been different. People have however already become comfortable with Unix shells, so it needs significant improvements to convince them to switch the tool of choice. While PS does have improvements, they're not significant enough to relearn everything.

To me, Unix scripts are more readable though, this is simply because Ive been writing them for so many years now, while I barely touched any PS code.

Re:GitHub – nushell/nushell: A new type of shell by AnIdiotOnTheNet on Wednesday June 16, 2021 @09:52AM (#27528497)
I very much disagree. There's a reason this is funny:

https://xkcd.com/1168/

Re:GitHub – nushell/nushell: A new type of shell by kaba0 on Wednesday June 16, 2021 @03:48AM (#27525980)
Sorry for calling you out on it, I often write opinion-pieces without much backing as well :)

I was initially very biased against PS as well, but then had to learn it and I found the design quite genius. At a time I even tried to use it as a daily driver on linux but my muscle memory is UNIXy, and there are a few edge cases that are harder in PS than in bash so I had to revert back. But we should strive to keep an open mind even about Microsoft technology :)

Re:GitHub – nushell/nushell: A new type of shell by 13of40 on Wednesday June 16, 2021 @03:07AM (#27525718)
> They have shells, so we should have it also

The thought process was more like "You can either hire a dude to do it by mouse in MMC or you can get someone with a masters in CS to do it in DCOM. We need a middle ground."

Source: was in the room

Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @03:43AM (#27525952)
Can you elaborate?
Re:GitHub – nushell/nushell: A new type of shell by pjc50 on Wednesday June 16, 2021 @04:39AM (#27526279)
Not OP, but: MMC = Microsoft Management Console, the collection of "snap in" GUI config tools for all the advanced features beyond Control Panel.

MMC can control remote computers, but I believe only one at a time? Unless it's something through Group Policy.

Now, the APIs exist to do all this remotely (DCOM), but good luck discovering what they are! And the minimum level of program you'd need to call them would be a C# project.

So, Microsoft knew that UNIX systems had an API that was interactive, scriptable, discoverable, and composable, all the things which CMD and MMC and DCOM aren't. So they decided to build one. And make it object-orientated. It's actually pretty good for the administration use-case, but for more general work it feels weird. And it doesn't interact with text files anywhere near as good as shell does.

Re:GitHub – nushell/nushell: A new type of shell by tenebrisalietum on Wednesday June 16, 2021 @02:49PM (#27532058)
Some snapins can connect to multiple servers/computers at once, such as the DHCP MMC snapin. Others can't, like Event Viewer.

IMHO Microsoft went all-in on the object-oriented paradigm and tuned the operating system to work with C++ ABIs and expecting administrators to use tools that use Microsoft or vendor provided DLLs.

Re:GitHub – nushell/nushell: A new type of shell by rjzzleep on Wednesday June 16, 2021 @06:44AM (#27526974)
Everything you say is accurate, but it doesn't really relate to his claim for the reasoning behind the decisions behind Powershell. That's what I was referring to when I asked for a more detailed elaboration.
Re:GitHub – nushell/nushell: A new type of shell by 13of40 on Wednesday June 16, 2021 @11:59AM (#27530021)
I worked in Windows Server on admin tools in the late 90s and 2000s, and watched the whole thing happen. I heard it summed up like that from Ballmer himself. I don't know what your alternative idea is - you think Microsoft was jealous of Linux and spent a hundred million dollars making a new shell just so they could feel proud?
Re:GitHub – nushell/nushell: A new type of shell by oblio on Wednesday June 16, 2021 @04:07AM (#27526092)
I'm sorry, are you a shell user? Since when ~, for example, is easy to type and - is hard to type? LOL.

First of all your backstory is wrong, it was a 1-person project. Then, about the features, all those long, explicit commands have short versions.

Secondly, I agree that Powershell feels a bit alien on Unix, which will probably be the main reason its adoption will never be amazing.

Re:GitHub – nushell/nushell: A new type of shell by Macha on Wednesday June 16, 2021 @07:06AM (#27527118)
For a long time the Windows equivalent of ~ was %USERPROFILE% which was definitely harder to type than ~. Eventually they introduced the shortcut on Windows too.
Re:GitHub – nushell/nushell: A new type of shell by gpvos on Wednesday June 16, 2021 @03:15AM (#27525773)
Same for me, but looking at nushell, I'm not ruling out that they'll end up with something very similar to it. (I haven't used Powershell much to be honest.)
Re:GitHub – nushell/nushell: A new type of shell by tonyedgecombe on Wednesday June 16, 2021 @05:37AM (#27526612)
powershell for unix

In general I really dislike "[some other product] for [a different use case]". It might be accurate but many potential users might never have heard of PowerShell or if they have only have a vague idea of what it is.

Re:GitHub – nushell/nushell: A new type of shell by thefunnyman on Wednesday June 16, 2021 @03:16PM (#27532309)
I find it hard to believe that someone looking into alternative shells would have never heard of PowerShell. I get that Windows isn’t exactly most people’s OS of choice, but the existence of PowerShell is widely known.
Re:GitHub – nushell/nushell: A new type of shell by tonyedgecombe on Thursday June 17, 2021 @01:38AM (#27536401)
I know that fish shell exists but I have absolutely no idea what distinguishes it from bash or zsh, both of which I use regularly. The extent of my knowledge comes from seeing the name in a HN title.

It's not hard to imagine the same for PowerShell.

Re:GitHub – nushell/nushell: A new type of shell by d0mine on Saturday June 19, 2021 @04:58AM (#27558981)
The philosophy part reminds me of `jq` with its functional style processing:

1. parse a json value from stdin and set it as the initial result

2. for each function, apply the function to the result, and set the output as the result for the next function.

3. The final result is pretty printed on stdout.

https://codefaster.substack.com/p/mastering-jq-part-1-59c

Re:GitHub – nushell/nushell: A new type of shell by BatmanAoD on Wednesday June 16, 2021 @10:07PM (#27535524)
It used to have a motto that was something like "a shell for the github age", and I guess they never picked something more appropriate.