From 2f8ed116461cef62125b1803a8a80af1a6dce3a1 Mon Sep 17 00:00:00 2001 From: sharpchen Date: Fri, 19 Jun 2026 17:57:53 +0800 Subject: [PATCH 1/2] Fix comparison for pwsh and csharp --- book/coming_from_powershell.md | 102 ++++++++++++++--------------- book/nushell_map.md | 34 +++++----- book/nushell_operator_map.md | 39 +++++------ ja/book/nushell_operator_map.md | 37 ++++++----- ko/book/nushell_operator_map.md | 38 +++++------ zh-CN/book/nushell_operator_map.md | 38 +++++------ 6 files changed, 145 insertions(+), 143 deletions(-) diff --git a/book/coming_from_powershell.md b/book/coming_from_powershell.md index 52e4ae4ab60..c27ae13c3bd 100644 --- a/book/coming_from_powershell.md +++ b/book/coming_from_powershell.md @@ -14,57 +14,57 @@ This means: ## Command Equivalents: -| PowerShell | Nu | Task | -|-------------------------------------------------------------------|-----------------------------------------------|-------------------------------------------------------------------| -| `Get-ChildItem` | `ls` | List files in current directory | -| `Get-ChildItem ` | `ls ` | List files in given directory | -| `Get-ChildItem pattern*` | `ls pattern*` | Pattern-match files | -| `Get-ChildItem -Force -File -Hidden` | `ls --long --all` or `ls -la` | Detailed listing including hidden files | -| `Get-ChildItem \| Where-Object { $_.PSIsContainer }` | `ls \| where type == dir` | List directories only | -| `Get-ChildItem -Recurse -Filter *.rs` | `ls **/*.rs` | Recursive search for files | -| `Get-ChildItem -Recurse Makefile \| Select-Object -Expand Name` | `ls **/Makefile \| get name \| vim ...$in` | Pass matched paths to command | -| `Set-Location ` | `cd ` | Change directory | -| `Set-Location` | `cd` | Go to home directory | -| `Set-Location -` | `cd -` | Go to previous directory | -| `New-Item -ItemType Directory ` | `mkdir ` | Create a directory | -| `New-Item test.txt` | `touch test.txt` | Create a file | -| `command \| Out-File ` | `out> ` or `o> ` | Save output to file (raw) | -| `command \| Set-Content ` | `\| save ` | Save output to file (structured) | -| `command \| Out-File -Append ` | `out>> ` or `o>> ` | Append output to file | -| | `\| save --append ` | Append structured output | -| `command \| Out-Null` | `\| ignore` | Discard output | -| `cmd1 \| Tee-Object -FilePath log.txt \| cmd2` | `cmd1 \| tee { save log.txt } \| cmd2` | Tee output to file | -| `command \| Select-Object -First 5` | `command \| first 5` | Limit output to first N rows | -| `Get-Content ` | `open --raw ` | Display file contents | -| `Move-Item ` | `mv ` | Move file | -| `Get-ChildItem *.md \| ForEach-Object { $_.Name }` | `ls *.md \| each { $in.name }` | Iterate list values | -| `foreach ($i in 1..10) { $i }` | `for i in 1..10 { print $i }` | Loop over range | -| `Copy-Item ` | `cp ` | Copy file | -| `Copy-Item -Recurse ` | `cp -r ` | Copy directory recursively | -| `Remove-Item ` | `rm ` | Remove file | -| | `rm -t ` | Move file to trash | -| `Remove-Item -Recurse -Force ` | `rm -r ` | Remove directory recursively | -| `Get-Date ""` | `"" \| into datetime -f ` | Parse date | -| `"" -replace 'a','b'` | `str replace "a" "b"` | Replace substrings | -| `Select-String ` | `where $it =~ ` or `find ` | Search text | -| `Get-Help ` | `help ` | Get command help | -| `Get-Command` | `help commands` | List all commands | -| `Get-Command "**"` | `help --find ` | Search commands | -| `command1; if ($?) { command2 }` | `command1; command2` | Run second command only if first succeeds | -| `/tmp/$((Get-Random))` | `$"/tmp/(random int)"` | String interpolation | -| `$env:Path` | `$env.PATH` or `$env.Path` | Show PATH | -| `$LASTEXITCODE` | `$env.LAST_EXIT_CODE` | Exit code of last external command | -| `$env:PATH += ":/usr/bin"` | `$env.PATH = ($env.PATH \| append /usr/bin)` | Update PATH (temporary) | -| `Get-ChildItem Env:` | `$env` | List environment variables | -| `$env:FOO` | `$env.FOO` | Access environment variable | -| `Remove-Item Env:FOO` | `hide-env FOO` | Unset environment variable | -| `Set-Alias s "git status -sb"` | `alias s = git status -sb` | Temporary alias | -| `Get-Command FOO` | `which FOO` | Inspect command / alias / binary | -| `powershell -Command ""` | `nu -c ` | Run inline pipeline | -| `.\script.ps1` | `nu