Nushell.sh ls | where size > 10mb | sort-by modified
71–80 of 215 posts
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#72So, '>' 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…
For no good reason at all.
It's not less confusing, and when shell programmers start talking about how wasteful it is to fork another process, it's because all the good explanations were already refuted.
Also, it's worth pointing that this style was never unanimous. There is a very vocal minority that pushes for it, and a wide non-vocal majority that says basically "whatever, it's not like there's any difference" if you go and ask the question.
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#73> 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 on MacOS:
`anything | pbcopy`
The first example is actually the only one that makes sense to me:
> ls | where type == file
Amazingly, there's no straightforward way to tell `ls` to output only files (that I know of):
`ls -p | grep -v /`
I don't mean to knock it, but I think it's better to learn the standard tools available everywhere than invest any time in tools that aim to lessen the learning curve.
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#74Earlier 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…
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#75Re: Nushell.sh ls | where size > 10mb | sort-by modified
#76Earlier quoted context omitted.
I don't mind the looks but I find it hard to debug and have a poor instinct for "does this need a curly bracket or a parens?" That's my real issue with PowerShell, I find it very hard to predict what will work unless I know exactly what the rule is. Shell has similar issues but I've put 20 years into it so the knowledge is there. Every time the PowerShell people describe PowerShell I think "that sounds awesome" but t…
Blocks always use braces. Expressions use parentheses for grouping sub-expressions. It's the same as many C-like languages. I can't imagine any situation where you would be confused which one you need to use.
Why is that test returning a boolean on the GP a block?
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#77I'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…
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#78Re: Nushell.sh ls | where size > 10mb | sort-by modified
#79I'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…
`ls -l|grep -e^-`
Unless you meant without pipes/grep in which case I think no, but, you're bumping up against the fact that `ls` is really more of a user-presentation tool than for scripting. Use `find . -type f` maybe with some `-maxdepth 1`
Re: Nushell.sh ls | where size > 10mb | sort-by modified
#80I have nothing but positive things to say about nushell, but I do wish the describe command took a positional argument rather than just being piped into. I was trying to write a pipeline that could give me all the versions from a Cargo.toml and "flatten" any records, but got stuck trying to use describe. Ex: open Cargo.toml | get dependencies | transpose | rename dep version | each { |row| let version = $row.version;…