⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shell_progress.txt

📁 在unix下的用shell写的进度显示小程序
💻 TXT
字号:
#!/bin/sh abort() {     printf  "\033[m\n"     exit } # do nothing, just simulate time consume. idle() {     i=1     sum=`date +%S`     sum=`expr $sum \* $sum | cut -b 1`     sum=`expr $sum \* 10`     while [ $i -le $sum ]; do         i=`expr $i + 2 `         trap abort  2     done } proc() {     begin=$1     end=$2     row=$3     pos1=`expr $begin + 1`     pos2=`expr $end - 1`     mid=`echo "($begin+$end)/2-2" |bc`     printf "\033[2J"     printf "\033[${row};${begin}H["     printf "\033[${row};${end}H]"     while [ $pos1 -le $pos2  ]; do         pro=`echo "scale=0; ($pos1 - $begin)*100/($pos2-$begin)" | bc`         if [ $pos1 -gt $mid ]; then             printf "\033[7m\033[${row};${mid}H$pro%%\033[${row};${pos1}H:"         else             printf "\033[m\033[${row};${mid}H$pro%%\033[7m\033[${row};${pos1}H:"         fi         pos1=`expr $pos1 + 1`         idle         trap abort  2     done     printf "\033[m\n"     echo "done" } # call subroutine printf "### proc 1 80 10 ### hit ENTER to continue " if read a; then     proc 1 80 10 fi printf "### proc 25 55 10 ### hit ENTER to continue " if read a; then     proc 25 55 20 fi 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -