What is the advantage over powershell?
Nushell.sh ls | where size > 10mb | sort-by modified
31–40 of 215 posts
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#32Earlier quoted context omitted.
- Better errors - Native support for JSON, etc (no more ConvertFrom-* ConvertTo-*) - Less verbose - Different visualisation
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.)
find . -maxdepth 1 -type f -size +10M -exec ls -lt {} +
Or a very terse example: du -s -h * | sort -r -h | sed 10q
The thing is that if you're already used to POSIX-compliant shells then this is simply natural to write. Nushell has a different proposition of making it closer to natural language, which makes the learning curve much better. PowerShell just makes it different, but not really that much better.Also this is somewhat tangential, but I hate that PowerShell 5 and 7 are completely different things, and that PowerShell 5 is still the default even in Windows 11.
Oh yeah, and just for lols this is the same thing in zsh:
ls -lt *(.L+10240k)
By the way, I should note that it's possible to make the PowerShell example much simpler like the following: gci | ? Length -gt 10MB | sort LastWriteTime
The thing that really gets me here is the need to know aliases to keep it short, if you were to do it without the aliases it would look like this: Get-ChildItem | Where-Object { $_.Length -gt 10MB } | Sort-Object LastWriteTime
Also, again, case-sensitive commands make me mad.Re: Nushell.sh ls | where size > 10mb | sort-by modified
#33Earlier quoted context omitted.
Sorry but that looks terrible.
What about it looks terrible? The braces are necessary, because this is a lambda.
gci | ? Length -gt 10MB | sort LastWriteTimeRe: Nushell.sh ls | where size > 10mb | sort-by modified
#34What's the advantage of this over PowerShell?
- less verbose syntax
- better cross-platform support (PowerShell is technically cross-platform, but it has some baggage from its Windows-first history)
- way faster to start up
I'm biased (I'm a member of the Nushell core team), but those are all things that drew me to start contributing to Nushell.
On the other hand, Nushell is certainly less mature+stable than PowerShell. And if Windows administration is your main use case, PowerShell can't really be beat.
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#35Re: Nushell.sh ls | where size > 10mb | sort-by modified
#36So, '>' isn't for redirection anymore. How does one do that? open foo.txt | append "world"| save --raw foo.txt Oh.
This reminds me of how Fish handles process substitution without requiring a special syntax. I love it! It may seem a bit odd or even cumbersome to experienced shell programmers, but in my experience with Fish, this kind of thing helps a lot with ease of learning.
Fish is amazing!
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#37So, '>' isn't for redirection anymore. How does one do that? open foo.txt | append "world"| save --raw foo.txt Oh.
Historically we would discourage shell users from cat somefile.txt | whatever and instead tell them to use either whatever or, if the command accepts input file names as arguments then use those like whatever somefile.txt or whatever -i somefile.txt etc But perhaps in fish, “useless use of cat” is not so useless and would be recommended? (I mean aside from the fact that they seem to recommend their “open” command, an…
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.
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#38Re: Nushell.sh ls | where size > 10mb | sort-by modified
#39 [zsh]$ ls -l *(Lm+10om)
zsh supports extended globs, this says: -l give me a long listing
“*(…)” of any file
Lm+10 who’s size “L” in megabytes “m” is greater than 10
“om” ordered by modification ascendingRe: Nushell.sh ls | where size > 10mb | sort-by modified
#40Earlier 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…