Live data from Hacker News

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

nushell.sh

181–190 of 215 posts

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

#181

Earlier quoted context omitted.

For some reason I never liked to do it the "right way". First of all it doesn't seem to actually matter. But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift. It also makes it easier to add arguments to the end if re-running it.

>But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift. Using ` out_file` (Though annoyingly this doesn't work for feeding input to while loops. `< <(echo a; echo b; echo c;) while read -r foo; do echo "$foo"; done` is invalid syntax; it needs to be `while read -r foo; do echo "$foo"; done < <(echo a; echo b; echo c;)`)

doesn't it work if you put it after the while but before the read?

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

#182

Earlier quoted context omitted.

This is the same reason I eventually learned and stuck with Vi(m). Implementing a project on a massive array of SPARC Solaris boxes and every "easy' tool I'd learned just... wasn't there. I had kind of learned Vi at that point, but wasn't remotely proficient in it, and had only gotten as far as I had due to a bunch of cool plugins I'd installed that definitely weren't available.

That last part is often forgotten. I usually stick with defaults (or as close as I reasonably can) not because they are functionally better but because for most things I don't have the return on learning and regularly using two instances of ${tool} isn't worth the extra time. Sometimes it's a pain but it seems to pay off.

And when I'm doing something on my local machine - very often, a more modern tool is required anyway. (Visual Studio in the case of C#/C++, and VS Code is infinitely quicker and simpler to get up and going with when editing other source code).

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

#183

Earlier quoted context omitted.

PowerShell isn’t that verbose, compared to NuShell. The ls example would be (with standard PowerShell aliases): gci | where { $_.Length -gt (10 * 1024 * 1024) } | sort LastWriteTime -gt might seem weird, but it’s better than overloading >. (Also, I like the fact that PowerShell is built into Windows and has a large corporation behind it.)

The fact PowerShell has this masochistic tendency to have commands that start with capital case already makes it outside of the realm of consideration for me. It's absolute nonsense. Also I have to say your example is extremely confusing and would probably take quite a bit of time to write IRL. For reference, the equivalent in sh would be: find . -maxdepth 1 -type f -size +10M -exec ls -lt {} + Or a very terse exampl…

I think I'm an outlier/odd-one for liking PowerShell, but terseness hasn't been a goal for me when I write in PS. I typically write and maintain long scripts and spelling everything out helps me keep track of the logic.

It's not the best language for anything, but working a Windows shop, I'd rather bang stuff out in PS than grind my way through Visual Studio/C# for simple tasks.

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

#184
post #162
post #120

My problem with alternative shells (anything not bash) is that I have to learn bash anyway, and if I want to use a scripting language that requires me to first install a runtime, drop into it, doesn't work on colleagues machines, etc. then there are many non-shell alternatives that are better. I'll learn nushell or whatever once a mainstream or somehow desirable distro ships with it as their default shell.

> I have to learn bash anyway Do you? You need bash installed, certainly, but you don't need to learn bash in order to merely execute bash scripts. To use an analogy, just because your distro scripts things in Python doesn't mean one needs to learn Python to use the distro. I basically never need to write or read a bash scripts these days (I use fish, but I rarely write a real fish script either; just learn the langu…

As a fellow fish user, I agree. Occasionally I write fish scripts/functions, but they're for my environment so I don't expect them to run on other people's fish shells, let alone bash. Then when I am in another shell, I can usually get by on the minimum (glob, pipes, redirection), which is mostly fairly universal. And when I'm not SSHd into some other machine (which is 99% of the time), then I get all the superpowers of fish to use.

It's a bit like the equivalent vim argument. Yes, using unmodified vim means you have access to the same tools in every environment. But I spend 99% of my time in one environment, so I'd like to optimise for that one, whether that's by using an IDE or installing a bunch of vim plugins and customising everything. Then when I do need to SSH into a server somewhere, I can get by on the bare minimum - in my case, usually nano. If I'm using nano for long enough that I start missing my IDEA features, then I've been using nano for too long and need to figure out a different way of deploying/debugging changes in the first place.

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

#185
post #73

I'm sure there's a lot more once you get to more advanced stuff, but going through their System examples has me puzzled: > ls | where type == dir or in Bash: `ls -d` > ps | where cpu > 0 | sort-by cpu | reverse or in Bash: `htop` ? > ps | where name == Notepad2.exe > # find process, then ... > ps | where name == Notepad2.exe | get pid.0 | kill -9 $in or in Bash: `pkill Notepad2.exe` > Pipeline content to clipboard Or…

Literally nothing you mentioned is a shell builtin, your choice of shell matters not at all.

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

#186

Earlier quoted context omitted.

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?

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

At the moment there is POC code to transmit over fd 3 but I’m looking into using UNIX sockets instead.

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

This project predates Rust 1.0 so it was a no brainier at the time to use Go. But actually I do think Go is well suited for this type of problem because much as some complain about errors being regular types, the way Go encourages granular handling of errors rather than larger try / catch blocks or exceptions does lead to more tailored error messages. Which ultimately helps explain the problem better for the end user.

Not taking anything away from Rust or any other language. Nor am I saying Go’s error handling doesn’t have its problems. Just that I’d probably choose Go again if I were to start this project tomorrow.

> Can you customize the PS1?

Every part of the shell is customisable. However rather than having hard to discover environmental variables that can alter the shells behaviour, instead there is a command called config that allows you to inspect every option.

https://murex.rocks/docs/commands/config.html

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

#187
post #120

My problem with alternative shells (anything not bash) is that I have to learn bash anyway, and if I want to use a scripting language that requires me to first install a runtime, drop into it, doesn't work on colleagues machines, etc. then there are many non-shell alternatives that are better. I'll learn nushell or whatever once a mainstream or somehow desirable distro ships with it as their default shell.

This is the same reason I eventually learned and stuck with Vi(m). Implementing a project on a massive array of SPARC Solaris boxes and every "easy' tool I'd learned just... wasn't there. I had kind of learned Vi at that point, but wasn't remotely proficient in it, and had only gotten as far as I had due to a bunch of cool plugins I'd installed that definitely weren't available.

That is a good point. But Nu offers someting else:

> First and foremost, Nu is cross-platform. Commands and techniques should work across platforms and Nu has first-class support for Windows, macOS, and Linux.

Source: GitHub. No snark intended.

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

#188
post #69

Earlier quoted context omitted.

I'm not really sure which other popular languages would be considered memory safe AND strongly typed. I know of both C and C++ which I wouldn't consider memory safe. And I know of Javascript, which is not strongly typed... so which do you mean?

Java, Scala, Kotlin, C#, D, Go, and TypeScript to name a few.

Of those only D and Go build self contained binaries (yes i know about Graal/Kotlin Native/.Net AOT). No snark intended.

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

#189
post #120

My problem with alternative shells (anything not bash) is that I have to learn bash anyway, and if I want to use a scripting language that requires me to first install a runtime, drop into it, doesn't work on colleagues machines, etc. then there are many non-shell alternatives that are better. I'll learn nushell or whatever once a mainstream or somehow desirable distro ships with it as their default shell.

This is the same reason I eventually learned and stuck with Vi(m). Implementing a project on a massive array of SPARC Solaris boxes and every "easy' tool I'd learned just... wasn't there. I had kind of learned Vi at that point, but wasn't remotely proficient in it, and had only gotten as far as I had due to a bunch of cool plugins I'd installed that definitely weren't available.

Nano is fairly commonly installed mercifully. Micro (which is an actually "normal" terminal editor) is becoming more popular too and is also trivial to install (since it is written in Go).

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

#190

Earlier quoted context omitted.

The fact PowerShell has this masochistic tendency to have commands that start with capital case already makes it outside of the realm of consideration for me. It's absolute nonsense. Also I have to say your example is extremely confusing and would probably take quite a bit of time to write IRL. For reference, the equivalent in sh would be: find . -maxdepth 1 -type f -size +10M -exec ls -lt {} + Or a very terse exampl…

Get-Old -Fast

I thought you just ranted but then saw the space between it and you acctually wrote something that contributed to the conversation. Well done.
Post reply on HN