Live data from Hacker News

GitHub – nushell/nushell: A new type of shell

github.com

401–410 of 411 posts

Re: GitHub – nushell/nushell: A new type of shell

#401
post #376

Earlier quoted context omitted.

wait how does the OS even invoke an interpreter without a shebang? If you have to explicitly call an interpreter when you invoke it, then it's no extra work to call bash some_script.sh anyway

As I’ve learned in response to this thread, apparently some (but not all) Unixy OSes will run a file marked as executable using /bin/sh if no shebang is supplied.

Oh right, I think that's part of how APE[1] works. But I thought the Thompson shell was old and weird, and that it might not support what people use when they write ‘POSIX’ shell scripts nowadays.

Anyway it sounds like in that case the OS _doesn't_ know how to run the script, it just assumes `/bin/sh` will do.

I always assumed that scripts without an interpreter line were like snippets to be invoked via `source`, from some shell script with knowledge of the context in which it should be used.

Anyway, if that's the way it works, the behavior actually isn't a problem for users of Nushell or Elvish or Fish or anything else, since their executables are never installed to `/bin/sh` anyway. Nushell probably gets installed to `/usr/bin/nu`, Fish to `/usr/bin/fish`, and `elvish` can be installed anywhere. So it's still not clear that there's a real problem with un-shebanged scripts when it comes to using a boutique shell for login.

1: https://justine.lol/ape.html

Re: GitHub – nushell/nushell: A new type of shell

#402
post #248
post #236

Earlier quoted context omitted.

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…

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

It looks like: `curl | 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

#403

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."

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

#404
post #207

Earlier quoted context omitted.

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

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

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

#406
post #402
post #248

Earlier quoted context omitted.

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

It looks like: `curl | 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 i…

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

#407
post #107

Thinking this is so cool! I was wondering if seriously buying into an alternate shell like this would be worth it in the long run. Would really love to read from people who use(d) an alternative shell, both success and failure stories. I cannot shake from my head the idea that buying into a non-standard shell will only work for personal projects in one's own workstation, but it won't fly too far for company work beca…

I'm generally supportive of the effort to replace the archaic shells that dominate the unix landscape, but unfortunately none have yet met my personal desires. It seems like a lot of the developers of these shells create them to supplement the common unix toolset, but I really want a complete replacement. Ideally, the shell itself would be a completely dependency-free static executable, with a built-in command set th…

So I take it you're waiting for the systemd shell then? lol

Re: GitHub – nushell/nushell: A new type of shell

#408

Earlier quoted context omitted.

Why is everything written in rust nowadays? Apart from the safety it provides.

hype language du jour In the past it has been Lisp, Python, Haskell, Go, etc.

Downvoting me doesn't make it less true.

Re: GitHub – nushell/nushell: A new type of shell

#409
post #402
post #248

Earlier quoted context omitted.

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

It looks like: `curl | 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 i…

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

#410
My issue with these types of things is always the same. Awesome it does all this stuff I love it, I use it everywhere.

Dev: I have decided to stop working on this project thanks for all the support. If anyone wants to take ownership of it I am willing to transfer its ownership. (Crickets)

Me now after using it for a couple of years have to go back to standard bash or whatever and now people think I have no idea what I'm doing since I forgot so much stuff from lack of daily use.

Post reply on HN