zsh换行与输入回显异常排查(EDIT:无换行回归,存在其他问题)
我最近从Bash迁移到OS X Catalina系统自带的zsh,同时搭配oh-my-zsh使用,近期发现偶尔会出现换行符丢失或者输入回显异常的情况,目前已经确认至少两个典型案例,另外还有一个更奇怪的关联现象,具体细节如下:
场景1:time命令的输出异常
在zsh下执行time命令时,输出格式和内容都和sh下有差异,后续还发现了更极端的时间报告缺失情况:
zsh下的执行结果:
~ ▶ time ls 1pwd.bkp Downloads Pictures 'VirtualBox VMs' go pf-docs.txt tools Applications Library Public bin istio-lean.yaml plugins.sbt.bkp wip Desktop Movies SWIFT docs.txt main.txt project workshop Documents Music Snapshots git normal.yml todo gls --color=tty 0.00s user 0.00s system 62% cpu 0.009 total
sh下的执行结果:
~ ▶ /bin/sh # time ls 1pwd.bkp Downloads Pictures VirtualBox VMs go pf-docs.txt tools Applications Library Public bin istio-lean.yaml plugins.sbt.bkp wip Desktop Movies SWIFT docs.txt main.txt project workshop Documents Music Snapshots git normal.yml todo real 0m0.011s user 0m0.003s sys 0m0.005s
场景2:sbt/g8工具的输入回显丢失
在zsh下使用sbt new创建项目时,用户输入的内容完全没有回显,甚至缺少应有的空换行;而在sh下执行则一切正常:
zsh下的执行结果:
~/wip/deleteme ▶ sbt new scala/scala-seed.g8 [info] Loading settings for project global-plugins from build.sbt ... [info] Loading global plugins from /Users/ignasi/.sbt/1.0/plugins [info] Set current project to deleteme (in build file:/Users/ignasi/wip/deleteme/) [info] Set current project to deleteme (in build file:/Users/ignasi/wip/deleteme/) A minimal Scala project. name [Scala Seed Project]: Template applied in /Users/ignasi/wip/deleteme/./myprojectzsh
注:这里实际输入了myprojectzsh但完全没有回显,且name [...]:之后没有空换行
sh下的执行结果:
~/wip/deleteme ▶ /bin/sh sh: _direnv_hook: command not found %n@%m %1~ %# sbt new scala/scala-seed.g8 [info] Loading settings for project global-plugins from build.sbt ... [info] Loading global plugins from /Users/ignasi/.sbt/1.0/plugins [info] Set current project to deleteme (in build file:/Users/ignasi/wip/deleteme/) [info] Set current project to deleteme (in build file:/Users/ignasi/wip/deleteme/) A minimal Scala project. name [Scala Seed Project]: MyProjectBinSh Template applied in /Users/ignasi/wip/deleteme/./myprojectbinsh # ls
额外的奇怪现象:time echo hello无时间报告
在zsh下执行time echo hello时,本该出现的时间报告完全没有打印出来:
▶ time echo hello hello ~ ▶
目前我还没完全确认这是time和sbt/g8各自的独立问题,还是zsh本身的共性问题,但它们的核心症状(回显/换行丢失)是一致的。
内容的提问来源于stack exchange,提问作者ignasi35
相关产品推荐
相关产品推荐

