Progress bar--shell Script implementation

Source: Internet
Author: User

Progress bar in the future development, testing, operation and maintenance, can be automated inspection project updates, operation and so on, greatly accelerate the efficiency of work.

1. Code implementation

  1 #!/bin/bash  2 function proc ()   3 {  4      count=0  5     bar= ""   6      lable= ("|"   "/"   "-"   "\")   7     while [  $count  -le  100 ]  8     do  9          let index=count%4 10         printf   "[\033[1m\033[1;34m%-101s\033[0m] [%d%%] [%c]\r"   "$bar"   "$count"   "${lable[$ Index]} " 11         bar=${bar} ' = '  12           ((count++))  13          sleep 0.05 14     done 15     printf  "\ n "&Nbsp;16 } 17 proc 

2. Output Result:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/82/DB/wKiom1dioIbQeeYpAAAN8_TSNQg227.png "title=" bar. PNG "alt=" Wkiom1dioibqeeypaaan8_tsnqg227.png "/>

This article is from the "sunshine225" blog, make sure to keep this source http://10707460.blog.51cto.com/10697460/1790053

Progress bar--shell Script implementation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.