macOS zsh 在末尾打印换行符
macOS zsh prints newline at end
下面将“[COW]”向右对齐,但还添加了一个换行符。我不想换行,以便打印的下一个内容打印在同一行上(但左对齐)。我该怎么做呢?我见过的所有文档都说 printf
不添加换行符,但是如果您将下面的第二行加倍或加倍,很明显它会添加换行符
col=$(tput cols)
printf '%*s' $col "[COW]"
printf "do you see that %s over there:" "cow"
注意:zsh 5.8 (x86_64-apple-darwin20.0)
printf
没有添加换行符。终端仿真器正在滚动,因为您写的超过了行尾。
你应该在第一条消息的末尾写一个回车return,这样它就回到了行首。
col=$(tput cols)
printf '%*s\r' $col "[COW]"
printf "do you see that %s over there:" "cow"
下面将“[COW]”向右对齐,但还添加了一个换行符。我不想换行,以便打印的下一个内容打印在同一行上(但左对齐)。我该怎么做呢?我见过的所有文档都说 printf
不添加换行符,但是如果您将下面的第二行加倍或加倍,很明显它会添加换行符
col=$(tput cols)
printf '%*s' $col "[COW]"
printf "do you see that %s over there:" "cow"
注意:zsh 5.8 (x86_64-apple-darwin20.0)
printf
没有添加换行符。终端仿真器正在滚动,因为您写的超过了行尾。
你应该在第一条消息的末尾写一个回车return,这样它就回到了行首。
col=$(tput cols)
printf '%*s\r' $col "[COW]"
printf "do you see that %s over there:" "cow"