3 ms·
ls is an alias for Get-ChildItem in Powershell as well, btw
by shortrounddev 4y ago
ls is an alias for Get-ChildItem in Powershell as well, btw
- Arnavion 4y agoOnly 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-new/unix-support?view=powershell-7.3#aliases-not-available-on-linux-or-macos https://learn.microsoft.com/en-us/powershell/scripting/whats...
- Diti 4y agoAliases 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).
- jodrellblank 4y agoCommand 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`
- yencabulator 4y agoFrankly, you lost my interest at LCM, MOF & DSC.
- Arnavion 4y agoFor scripts that you intend to be used by other people, yes. My comment was about personal scripts.