niubash
RustAI-native 的真·Bash:真语法、真 Unix 命令、原生三平台
AI-native 的真·Bash 家族——真语法、真 Unix 命令、原生 Windows / Linux / macOS,无 WSL、无 MSYS。
AI-native bash family — real syntax, real Unix commands, native Windows / Linux / macOS. No WSL, no MSYS.
83/83 GNU 套件 · 176+ 命令 · ~14 ms git(Windows 同机)· 24 AI agents
# 安装 · session 1/3
PS C:\> irm https://unixwin.dev/install.ps1 | iex
downloading niubash-win-x64-setup.exe …
✓ Niubash 1.5.2 installed
PS C:\> niu --version
Niubash 1.5.2 — bash-compatible shell for Windows
# agent 接管 · 从 niu 会话启动 · session 2/3
cmx@unixwin:~$ claude
✓ shell: niubash (rubash engine) — 继承 niu 会话 $SHELL
agent> niu -c 'git log --oneline -1'
f0c0ffe niubash 1.5.2 — 真语法,真命令,原生三平台
agent>
# 速度 · session 3/3
cmx@unixwin:~$ time git --version
git version 2.56.0.windows.4.niugit
✓ real 0m0.014s ← niu-git
user 0m0.006s · sys 0m0.002s
# Git Bash 同机对照:real 0.045s – 0.103s(3–7× 慢)
six projects · one family
全部六项随 niubash 一键可得——装一次 niubash,六个产品全部就位。
why --real --fast --native
GNU Bash 上游 83 套测试套件全部通过,其中 82 套输出与 bash 逐字节一致——唯一残差经逐字节论证是 GNU 自己的竞态。存量脚本零修改。
suites 83/83 · byte-identical 82 ( ) 与 $( ) 零进程创建——子壳在进程内完成,fd
继承、共享偏移、退出码、信号处置与 GNU 行为一致。全平台同一模型,无 POSIX 模拟层。
( ) $( ) → 0 processes C:\、D:/、/d/、/mnt/d、/cygdrive/d——
四大生态的路径写法一个 shell 全收且真折叠。换 shell,不用改脚本。
C:\ · /d/ · /mnt/d · /cygdrive/d
Git Bash 会在 spawn 前启发式改写你的参数,你得学会
MSYS_NO_PATHCONV;niu 没有 MSYS 运行时——argv
逐字节原样抵达,这个词不存在,因为它不需要存在。
argv verbatim
从 niu 会话启动 Claude Code、Codex、Cursor,agent 按 $SHELL 约定直接用上
niubash;niu -c
单条命令、确定性输出,专为 agent 的反复调用与解析而生。
niu -c 'ls | grep src' git --version 约 ~14ms,Git Bash 要 45–103ms(均为 Windows 同机实测,niu-git 口径);提示符 git 段
每遍至多 spawn 一次(仓内 p50 26ms,Windows 实测),对方每条提示符给 git 交 113–362ms 的税。
git ~14ms(Windows 同机)· prompt ≤1 spawn/遍 Git Bash (MSYS)
argv 被运行时改写 → 三连败
niubash (niu)
argv 逐字节原样 → 一次通过
cd、cmd
/c、git grep -n 接连失败;niu 没有 MSYS 层,argv
逐字节原样抵达,同样的命令一次通过(见「无 MSYS 咒语」)。
右侧三条命令可直接复制到 niu 里复现。
quick start · 一行命令
winget install --id Unixwin.Niubash --source winget irm https://unixwin.dev/install.ps1 | iex curl -fsSL -o niubash.tar.gz https://github.com/unixwin/niubash/releases/download/v1.5.2/niubash-v1.5.2-linux-x86_64.tar.gz && tar xzf niubash.tar.gz curl -fsSL -o niubash.tar.gz https://github.com/unixwin/niubash/releases/download/v1.5.2/niubash-v1.5.2-macos-x86_64.tar.gz && tar xzf niubash.tar.gz wpm 看 help);装包如 wpm install neovim,自升级 wpm update winuxcmd。niu × claude code
$ claude # 在 niu 会话里启动,$SHELL 已指向 niubash
✓ shell: niubash (rubash engine) — git ~14 ms (Windows, same machine), 176+ unix commands
agent> niu -c 'ls | grep src'
src
agent> niu -c 'git log --oneline -1'
f0c0ffe niubash 1.5.2 — 真语法,真命令,原生三平台
agent>
# 引号地狱终结者:整条命令编成一个 base64 词,任何宿主层都改不动
agent> niu --ec "Z2l0IGxvZyAtMSAtLWZvcm1hdD0iY29tbWl0ICVoIG9uICVjZCIgLS1kYXRlPSJmb3JtYXQ6JVktJW0tJWQi"
commit a08e7afd on 2026-11-02
✓ 没有引号,就没有可被弄坏的东西——嵌套引号、$ 展开、heredoc、反斜杠塌缩,整类失败免疫
agent 用上 niubash 后,每一条命令都跑在真 bash
语法上——输出确定、启动够快,长会话也不掉链子。各家 agent
的启动方式与配置细节见
探测机制文档;命令递交的终极形态是
--ec——base64 直通、零引号穿越,cookbook 同在文档内。
tail -f changelogs.json
niubash 1.5.3
Engine and bundled-commands line rises to 1.5.3: the rubash …
rubash 1.5.3
GNU 差分修复波(2026-11-26 – 12-01):窗口内本仓共关闭 45 单,其中 5 单(#4169、#41…
WinuxCmd 1.2.4
wpm expose / unexpose (#1835, PR #2012): wpm gains the post-…
oh-my-niu 2.1.0
详见更新日志。