fix: remove redundant whitespace check; echo no-arg outputs empty line

This commit is contained in:
2026-03-18 19:40:02 +08:00
parent 717b7a95e8
commit 5b1c6d446c
2 changed files with 2 additions and 3 deletions

View File

@ -189,7 +189,7 @@ class PipelineRunner:
i += 1 i += 1
continue continue
if c.isspace() or c in " ": if c.isspace():
flush_word() flush_word()
i += 1 i += 1
continue continue

View File

@ -14,8 +14,7 @@ class THEcho(TextHandler):
self, env: TextHandlerEnvironment, istream: str | None, args: list[str] self, env: TextHandlerEnvironment, istream: str | None, args: list[str]
) -> TextHandleResult: ) -> TextHandleResult:
# echo 不读 stdin只输出参数Unix 语义) # echo 不读 stdin只输出参数Unix 语义)
if len(args) == 0: # 无参数时输出空行(与 Unix echo 行为一致)
return TextHandleResult(1, "请在 echo 后面添加需要输出的文本")
return TextHandleResult(0, "\n".join(args)) return TextHandleResult(0, "\n".join(args))