这是我的bash文件的一部分。我需要的输出是:微调框动画和回显命令
[ - ]版权所有KatworX©技术。由阿琼·辛格Kathait开发和调试由☆堆栈溢出社区☆
我想在显示echo命令微调动画继续旋转5秒。社区可以帮助吗?
spinner()
{
local pid=$!
local delay=0.75
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
}
sleep 5 & spinner | echo -e "\nCopyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆"
看一看[多种颜色上的bash微调的输出( https://stackoverflow.com/questions/46966891/multiple-colors-on-output-of-bash-spinner)。您可以忽略颜色的变化。但在while循环中调用'ps','awk'和'grep'的效率非常低。 –
你能否修改此代码段@DavidC.Rankin并将其发布到评论框中? –