Reputation: 925
(EDIT): The description below are two unrelated behaviors: one is behaving as expected, the other is an actual issue inrelated to zsh
. There is no new-line regression in zsh
.
I've migrated to zsh
from bash
in OSX (Catalina). I also use oh-my-zsh
. I've noticed recently the new line character or the echo of the input is sometimes missing. I've found at least two cases:
time
: (first invocation uses /bin/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
~
▶ /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
#
sbt
/g8
: (first invocation uses /bin/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
~/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
Note how the invocation under /bin/zsh
doesn't echo the user input (myprojectzsh
) after name [...]:
:
name [Scala Seed Project]:
Template applied in /Users/ignasi/wip/deleteme/./myprojectzsh
and even is missing a blank newline.
I haven't ruled out the issue is actually two different problems in time
and sbt
/g8
which happen to have the same symptoms.
PS:Things get even a bit weird when I try time echo hello
in /bin/zsh
:
▶ time echo hello
hello
~
▶
Where the time
report is not even printed (?).
Upvotes: 0
Views: 643
Reputation: 1016
There is nothing messed up in 1. time
is built-in shell command in zsh (and also in bash). You can check for yourself
which time
Behaviour and output style of zsh time is different than the one in the bash. You can run "real" binary implementation of time
: /usr/bin/time command
and see it will produce yet another differently formatted output.
Also the reason why time echo hello
has no output is that in zsh time
has no effect on built-in commands like echo. If you really want to, you can force execution of subshell by using parenthesis like this time (echo hello)
, but ultimately this doesn't make any sense -- you are measuring time of subshell life, not the echo itself.
Upvotes: 2