docs: prevent stale trans script usage

This commit is contained in:
Codex
2026-06-18 03:59:21 +00:00
parent e062422931
commit 9c5d0778ef
2 changed files with 8 additions and 5 deletions
+2
View File
@@ -244,6 +244,8 @@ exec /root/unidesk/scripts/trans "$@"
`trans` 同样遵守 route/operation 解析器;route 后面的第一个 token 不是原生 ssh 命令字符串。带变量展开、管道、重定向或多条命令的远端逻辑,默认使用 `trans G14:/root/hwlab sh <<'SH'``sh` 走目标节点 `/bin/sh`,并继承 provider-gateway/G14 已长期化的 proxy 环境。需要 Bash 专有语法,例如 `set -o pipefail`、数组、`[[ ... ]]``${var:0:8}` 子串展开时,必须把 operation 写成 `bash`,例如 `trans D601:/home/ubuntu/workspace/hwlab-v03 bash <<'BASH'`。需要临时单步执行一行远端 shell 逻辑、且不想先创建脚本文件或 heredoc 时,使用 `trans G14:/root/hwlab sh -- 'sed -n "1,20p" a && sed -n "1,20p" b'``bash -- '<bash command>'`,CLI 会把单个字符串放进目标节点对应 shell 的 `-c`,第二个 `sed`、管道和重定向都会留在远端;`sh --``bash --` 只接受一个 shell command 字符串,多 argv 单进程命令必须走 `argv``exec` 或已知直接子命令。`script``shell` operation 已移除并会失败;不得用 `--shell bash` 或旧名绕过显式 shell 选择。`sh``bash` helper 会在用户 shell 文本前注入一个极小的 POSIX 兼容 `printf` wrapper,使 `printf "--- section ---\n"` 这类高频排障分隔标题在 dash/sh 与 bash 下行为一致;direct argv 形态不注入该 wrapper。单进程命令才直接写成 argv,例如 `trans G14:/root/hwlab git status --short --branch`。遇到分布式开发摩擦时,优先补强 `trans`/`tran` 的 route/operation、stdin helper 或目标节点环境,并把稳定解法写回长期参考文档,不要退回多层 shell 字符串拼接。
本地检索或引用 Markdown 命令片段时也要避免外层 shell 误解析。任何包含反引号的 pattern,例如文档里的 `` `trans ...` ``,都必须用单引号、`rg -F -e` 或 stdin/file 传入;禁止写进双引号参数,因为 shell 会先执行 backtick command substitution,可能在搜索旧文档时反而误触 `trans ... script` 这类已移除 operation。
### Standard Workspace-Prefixed Passthrough