Kir*_*ran 3 bash shell statusbar
首先,感谢大家的帮助.我可以看到我的项目在几天内成功完成..
我需要知道如何在Shell脚本中放置一个状态栏,就像这样.
No_of_files=55
index=0
while [ $index -lt $No_of_files ]
do
echo -en "$index of $No_of_Files Completed"
index=$((index + 1))
done
Run Code Online (Sandbox Code Playgroud)
预期成果:55个中的1个已完成,共有25个已完成
每次迭代时,都应该替换索引,而不是其他字符.
谢谢Kiran
您可以打印\r
以返回到行的开头,以便您可以覆盖使用新消息打印的最后一件事:
for (( I=0 ; I < 10 ; I++ )); do
echo -en "\r$I of 10 completed"
sleep 1
done
echo
Run Code Online (Sandbox Code Playgroud)
这看起来只是$I
数字会改变.