The boomerang progress bar under the shell

Source: Internet
Author: User

When you write a shell script, you encounter some long-awaited commands, and to make the user look more comfortable, add some display to make the script appear to be running instead of stuck.

So I did my own research and wrote the two scripts to provide a solution, but all have a disadvantage need to adjust the parameters according to the actual time to make it more consistent with the requirements

Hope to be helpful to everyone


First edition

#!/bin/bash

X= "

Y=0

While [$y-le 100]

Do

printf "Installation progress:%-50s%d%%\r" $x $y

Sleep 0.1

Let y+=2

x=# $x

Done

Echo


Second Edition

#!/bin/bash

X= "

Y=0

While [$y-le 50]

Do

printf "Installing please later:%-6s\r" $x

Sleep 0.5

Let y+=2

x=. $x

if [$x = = ' ... ']; Then

x=.

Fi

Done

printf "%10b" ... Installation Complete ...

Echo


The boomerang progress bar under the shell

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.