Live data from Hacker News

GitHub – nushell/nushell: A new type of shell

github.com

371–380 of 411 posts

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

#371

What if we added json output mode to all shell commands? Or at least make some wrappers that parse their unstructured text output into json. We would be able to use standard pipelines and jq to filter/query outputs, without any custom shells. Just imagine: ifconfig --json | jq '.[] | [.interface, .inet] | @tsv'

I am with you in principle - but I still don't get the jq path/filter syntax I'm afraid. I think I'd vastly prefer map/reduce/zip commandlets...

Ed: I'd say from a quick glance that I think I rather prefer nushell to powershell

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

#372
post #131
post #120

Earlier quoted context omitted.

No, you misunderstood. I meant that if you're going to document a block of command-line instructions, you should first make sure those commands work as-is in a clean system. A very easy way to do this (for me anyways) is using a Docker container. I use this method to test all of my documented commands. But there are other ways, of course, like using a clean VM. Regardless, just test the commands without assuming the…

You're telling me that people who want to replace a command-line utility are the same people who can't install a toolchain (or just download a binary and put it in their path)?

As someone who authors another shells (coincidentally similar to nushell) I can tell you that you'd be surprised at some of the bug reports you get.

Frankly I prefer the 10,000 approach suggested by XKCD: https://xkcd.com/1053/

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

#373

Earlier quoted context omitted.

Oh and how /bin/bash is bash3 on macOS instead of the contemporary bash5 by default. And how sh is dash on Debian, or Ubuntu, I forgot. Some of the reasons why I would prefer python3 scripts (or perl) over sh or bash

Pretty annoying to reliably #! to python3 as well. Is it /usr/bin/python or python3?

That's my worst. I think generally python3 is safe (if unnecessary) today? But for how long do we have to keep that around?

Can we now say Well python2 is EOL so python should certainly be v3+?

It is of course a more general issue with shebangs that it's a very loose 'dynamically linked' coupling, not necessarily judt affecting language version but environment/libraries too, it just seems particularly problematic or prevalent with python.

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

#374

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

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.

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

#375

Earlier quoted context omitted.

man free for me shows the BSD library functions manual, maybe it's different in Linux

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.

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

#376

Earlier quoted context omitted.

I don’t think I’ve ever seen a script written without the shebang. Btw, you can get around the ancient bash in macOS by installing a more modern bash and invoking with /usr/bin/env bash as your shebang. Not sure if that’s a great idea, mind you, but if you’re already writing scripts in something non-portable, it’s an option.

There are hundreds of sh files on github that don't have a shebang. Just because you don't write them and your colleagues don't doesn't mean they don't exist in the wild.

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

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

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

A case for trying Elvish:

I really like Elvish's emphasis on interactivity, its somewhat maximalist approach to interactivity-oriented builtins (like fuzzy filtering, its directory browser, etc.), and the fact that it's distributed as a single static executable.

I also like the developers, who are smart and kind people and generally pretty pleasant to interact with on GitHub or their Telegram chat (bridged to various other things).

None of this is a case against trying Oil, however, so perhaps it will not help your paralysis too much. ;)

NGS' readme also has a good comparison section listing alternative shells: https://github.com/ngs-lang/ngs#have-you-heard-of-project-x-...

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

#378

Earlier quoted context omitted.

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.

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 .

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

#380

Earlier quoted context omitted.

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.

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.

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.

Post reply on HN