terminal - 在 Zsh 中将 stderr 变为红色的代码错误?
问题描述
我确实有一些代码在 Zsh 中以红色突出显示标准错误;我从https://github.com/fniessen/shell-leuven#stderr-in-red复制了它
然而,发生了一些奇怪的事情:红色有时会被标准输出“破坏”,然后一直持续到屏幕的末尾(见最后一行,其中“已经是最新的”在以红色突出显示的区域之间被挤压):
(在第一个区块中同样奇怪的事情,在区块的末端有一条虚假的红线。)
如何解决这个问题?代码有问题吗?
PS - 上述输出的示例代码:
BLU=$(tput bold)$(tput setaf 4)
reset=$(tput sgr0)
find . -maxdepth 5 -name ".git" -type d | rev | cut -c 6- | rev | sed "s#^\./##" |
while IFS=$'\n' read -r repo; do
printf '%s\n' "Current repository: ${BLU}$repo${reset}"
git -C "$repo" remote update --prune
git -C "$repo" merge --ff-only "@{u}"
echo
done
解决方案
推荐阅读
- angular - ProfileImage Update 上的 Angular 也会更新标题
- node.js - 桌面上的推送通知在关闭后不断弹出
- python - 如何使端点更快地加载?
- c# - 如何在 C# 中有效地呈现非平凡的(动态的列和行数、单元格中的图形和控制元素......)网格?
- android - 从 backstack 获取特定的 Activity
- c# - Xamarin 后门调用 - 注册商在方法中发现签名不匹配
- javascript - 将事件属性解析为函数时的 Fullcalendar.io 问题
- vue.js - 动态加载/更改 Vuetify 选项卡
- javascript - 带有打字稿的reactjs中的“对象可能是'未定义'”
- hive - 将 sum 与多个内部连接一起使用