News for hackers. Stuff that matters.
Re:Nushell.sh ls | where size > 10mb | sort-by modified by shortrounddev on Sunday March 12, 2023 @04:49PM (#35126077)
ls is an alias for Get-ChildItem in Powershell as well, btw
Re:Nushell.sh ls | where size > 10mb | sort-by modified by Arnavion on Sunday March 12, 2023 @05:18PM (#35126432)
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...

Re:Nushell.sh ls | where size > 10mb | sort-by modified by Diti on Sunday March 12, 2023 @08:44PM (#35128943)
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 by Arnavion on Sunday March 12, 2023 @09:15PM (#35129302)
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 by jodrellblank on Sunday March 12, 2023 @11:09PM (#35130480)
Command names can be shadowed, you can `function get-content { "hello world" }` and that also breaks gc alias. The only safe way to script is to use the full command names including module names `Microsoft.PowerShell.Management\Get-Content`
Re:Nushell.sh ls | where size > 10mb | sort-by modified by yencabulator on Monday March 13, 2023 @01:02PM (#35138672)
Frankly, you lost my interest at LCM, MOF & DSC.