## 复现 ```bash v="echo hi there" $v | cat ``` 实际输出(niu 1.0.1 / rubash master 355f8a67,Windows / winuxcmd 1.0.0): ``` niu: line 1: echo hi there: command not found ``` 期望(GNU bash):输出 `hi there` —— 未加引号的 `$v` 必须做 field splitting,`echo` 作为命令名。 ## 影响范围 - 管道任意段的命令字位置(第二段同样失败):`echo pre | $v` → `echo hi: command not found` - 子 shell:`( $v | cat )` - 花括号组:`{ $v | cat; }` - 进程替换:`while read -r l; do echo "$l"; done < <($v | cat)` - 顶层简单命令正常:`$v` 单独执行时正确分词 ## 真实脚本受害案例 git-summary (MirkoLedda) 的 `list_repos`: ```bash find_cmd="find -L $1 -maxdepth 2 -type d -name .git -print0" while IFS= read -r -d $'\0'; do git_directories+=("$REPLY") done < <($find_cmd | sort -z 2>/dev/null) ``` `$find_cmd` 整串被当成一个命令名 → `find -L ... : command not found`,脚本失效。
Activity
caomengxuan666 commentedon Sep 7, 2026
已在 5a4fddc 修复:管道各级(含 builtin/external 分派)对展开后的首词按 GNU bash 语义做域分割,剩余字段作为前导参数。验证: → "hi there";第二段、子 shell、brace group、进程替换内均正确。
fix(expansion): nounset arithmetic fatality, pipeline command-word sp…
fix(comsub): admit word-level substitution shortcuts by whitelist (#117)