进展_酒吧.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了进展_酒吧.sh相关的知识,希望对你有一定的参考价值。

  1. # snippet: progress_bar.sh
  2. # version: 0.02
  3. # author: ksaver (at identi.ca)
  4. # license: http://creativecommons.org/licenses/BSD/
  5. # sets: progress_bar function
  6. # arguments: progress_bar function: optional arguments "Text" and width.
  7. # "Text": Any informative text string.
  8. # Width: An integer number, is the max width for the progress bar.
  9. # usage: Use into a script:
  10. # source progress_bar.sh
  11. # a) progress_bar "Counting:" 25 <<< $PERCENT
  12. # b) for i in {1..100}; do echo $i; sleep 1; done |progress_bar "" 20
  13. # output: Counting: [ ============> ] 50%
  14.  
  15. function progress_bar()
  16. {
  17. while read PERCENT
  18. do
  19. COUNT=0
  20. FOO='>'
  21. BAR=''
  22. CHAR='=' # Change by "#", "|" or any character.
  23. TEXT=${1:-"Progress:"} # Sets default value to var $TEXT
  24. WIDTH=${2:-40} # Sets default value to var $WIDTH
  25.  
  26. PROGRESS=$(($PERCENT*$WIDTH/100))
  27.  
  28. while [ $COUNT -lt $(($PROGRESS+1)) ]
  29. do
  30. printf " $TEXT [ %s%s ] $PERCENT%% " ${BAR} ${FOO}
  31.  
  32. BAR="${BAR}$CHAR"
  33. COUNT=$(($COUNT+1))
  34. done
  35. done
  36. echo " Done."
  37. }

以上是关于进展_酒吧.sh的主要内容,如果未能解决你的问题,请参考以下文章

进展_棒.py

酒吧小程序开发的功能和前景

一个测试工程师走进一家酒吧……

一个测试工程师走进一家酒吧……

成都酒吧沙发定制企业

酒香古气 PUNKRAFT 酒吧