【shell脚本】脚本实现彩色进度条

编程入门 行业动态 更新时间:2024-10-09 11:20:13

【shell<a href=https://www.elefans.com/category/jswz/34/1771291.html style=脚本】脚本实现彩色进度条"/>

【shell脚本】脚本实现彩色进度条

实现代码:

#########################################################################
# File Name: procbar.sh
# Author: liumin
# mail: 1106863227@qq
# Created Time: Sun 02 Jul 2017 09:21:46 AM CST
#########################################################################
#!/bin/bashnum=0
str='#'
max=100
pro=('|' '/' '-' '\')
while [ $num -le $max ]
do((color=30+num%8))echo -en "\e[1;"$color"m"let index=num%4printf "[%-100s %d%% %c]\r" "$str" "$num" "${pro[$index]}"let num++sleep 0.1str+='#'
done
printf "\n"
echo -e "\e[1;30;m"

进度条的原理在之前的博客有写过: http://blo

更多推荐

【shell脚本】脚本实现彩色进度条

本文发布于:2024-03-15 08:46:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1738511.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   进度条   彩色   shell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!