Live data from Hacker News

Nushell.sh ls | where size > 10mb | sort-by modified

nushell.sh

151–160 of 215 posts

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#151

Earlier quoted context omitted.

ls is an alias for Get-ChildItem in Powershell as well, btw

Only on Windows. On Linux it's the original `ls`. Same for `cat` and many other commands. That's why using `gci` / `gc` is safer if you want your script to work everywhere. https://learn.microsoft.com/en-us/powershell/scripting/whats...

Aliases can be redefined in certain situations (such as compiling a LCM configuration into a MOF for use with PowerShell DSC). The only safe way to script is to use the full command names (Verb-Noun).

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#152
post #105

Earlier quoted context omitted.

Besides it's also a fail-safe way to make sure the program doesn't modify the original file. random-app ./myfile.txt The app opens the file on its own. It could decide to write to it. cat ./myfile.txt | random-app The app receives chunks of the file from a pipe. It doesn't know where the original file is. This is especially useful if you aren't sure the program will by default modify the file (such as formatters).

Yeah but you get the same from random-app

Only if random-app is well-behaved (and if you knew it was you could just use `random-app ./myfile.txt`).

  $ echo foo > a.txt
  $ /proc/self/fd/0 )
  $ cat a.txt
  bar

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#153
post #135

I like the idea of piping structured data between processes instead of streams of bytes, but that's what PowerShell is for. I don't think I've ever met another dev who likes PowerShell

> I don't think I've ever met another dev who likes PowerShell I have. But they have never used bash, zsh, Fish, or NuShell.

I use Zsh at home, and PowerShell 5 (for DSC 1.1) and 7 at work. I love both. I would almost be tempted to use pwsh as my main shell on Linux, but I am too attached to Zsh’s amazing RPROMPT!

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#154

Earlier quoted context omitted.

I'd actually like the ability to do either raw bytes (traditional) or structured bytes (the NuShell/PowerShell idea) in an "opt-in" scenario. This would also allow a smoother transition/lack of needing to fully commit right off the bat. I've considered writing wrappers for standard utilities in Bash/Zsh that accept and output structured data in JSON (or maybe a denser serialization format that can easily convert to J…

This is similar to how my shell works. It still just passes bytes around but additionally passes information about how those bytes could be interpreted. A schema if you will. So it works as cleanly with POSIX / GNU / et al tools as it does with fancy JSON, YAML, CSV and other document formats. It basically sits somewhere between Powershell and Bash: typed pipelines like Powershell but without sacrificing familiarity…

Very interesting! Do you transmit this metadata on a different fd, like 3?

(reading more) Super cool. Since it's Go, does that mean runtime errors will silently fail and keep chugging along? /dig ;)

Can you customize the PS1?

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#155
post #127

Earlier quoted context omitted.

> What if someone starts from a clean slate. Which shell is better? Then they learn the better and end up having to learn bash anyway coz that's what runs on remote machines. There is also not that much to be gained. Common easy tasks might be easier to learn but just few percent faster in the end. Harder ones are faster by one-off script in "real" programming language most of the time. Harder repeatable one should n…

> coz that's what runs on remote machines Is that actually still an issue these days with Docker containers and what not? How often do you access a remote server via SSH where you share an account with your colleagues and cannot install another shell next to bash? (So that bash could still be the default but you could switch on the fly.)

I think the problem is more about friction. While it might be possible to install another shell on every remote server you work on, are the features really worth the trouble?

Also, I've sometimes had to work on remote boxes on an internal-only network, with no outside internet access. In that case installing anything new is even more of a pain, so it's easier to work with the defaults as much as possible.

That said, I'm all for learning new tools. Progress couldn't be made if everybody just stuck with the old. But there's always a trade-off to be made between time investment into new tools vs. just getting your work done with the old ones.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#156

What's the story with not having a deb / flatpak / appimage or snap distribution? Just lack of resources to help package?

Don't think we've had any requests for those, but we'd welcome contributions if someone wants to make it happen. For now, Homebrew works if you want a cross-distro way to install Nu on x64 Linux.

Looks like it's fairly trivial to build/get via cargo: https://www.nushell.sh/book/installation.html#build-using-cr...

I'm not likely to use brew on Linux (rather stow/xstow if I have to).

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#157
post #149

Earlier quoted context omitted.

"This thing I don't understand reminds me of another thing I don't understand, so it's bad I decided."

[flagged]

I thought it was an informative response. I certainly learned some stuff about shell I didn't know before. I'm still gonna use cat because it's simpler to me.

I think your snark is unfounded here.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#158
post #112
post #108

Earlier quoted context omitted.

Hm. Why not re-use "tee"? https://www.man7.org/linux/man-pages/man1/tee.1.html

`save` seems to be a general serialization command, which lets you save Nu objects in formats like JSON, YAML, and others. The `--raw` option seems like a convenience for enabling that tee-like usage without relying on external programs, but the driving use case is serializing structured data rather than unstructured text or byte streams.

Ah, I failed to realize that nushell deals with rich data.

I think this might hit the sweetspot for me, for dealing with json - I never could get a feel for "jq" like I have with sed/awk, and don't much enjoy powershell.

I don't think I need a new shell (bash is fine - and I would probably move to fish for a new shell if I were to change) - but I certainly need a sane way to wrangle json (hello docker inspect!) and yaml (hello kubectl/k8s and github actions!).

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#159
post #151

Earlier quoted context omitted.

Only on Windows. On Linux it's the original `ls`. Same for `cat` and many other commands. That's why using `gci` / `gc` is safer if you want your script to work everywhere. https://learn.microsoft.com/en-us/powershell/scripting/whats...

Aliases can be redefined in certain situations (such as compiling a LCM configuration into a MOF for use with PowerShell DSC). The only safe way to script is to use the full command names (Verb-Noun).

For scripts that you intend to be used by other people, yes. My comment was about personal scripts.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#160

Earlier quoted context omitted.

Yeah but you get the same from random-app

Only if random-app is well-behaved (and if you knew it was you could just use `random-app ./myfile.txt`). $ echo foo > a.txt $ /proc/self/fd/0 ) $ cat a.txt bar

That's bizarre and perverse! Surely someone has brought it up as a bug before that stdin is read-write! Is there some Posix standard preventing the standard shells from opening stdin as read-only???
Post reply on HN