Several groups of Shell-written progress bar programs

Source: Internet
Author: User
Tags usleep

1. Add the $ symbol:
#! /Bin/sh
Echo | awk '{printf "^) ^", $1 }'
While sleep 1
Do
Echo "$" | awk '{printf "% s", $1 }'
Done

 

2 changed sticks:
#! /Bin/bash

I = 0
While [$ I-lt 10]
Do
For J in '-''//'' | ''/'
Do
Echo-ne "/033 [1D $ J"
Usleep 50000
Done
(I ++ ))
Done

 

3. display the progress bar:
#! /Bin/bash

I = 0
While [$ I-lt 20]
Do
(I ++ ))
Echo-ne "=>/033 [s"
Echo-ne "/033 [40; 50 H" $ (I x 5*100/100) % "/033 [U/033 [1D"
Usleep 50000
Done
Echo

 

4. display the progress bar and changed table names:
#! /Bin/bash

I = 0
Total = 53

percent = $ (echo "scale = 4; 100/$ total" | BC)
while [$ I-lt $ total]
DO
(I ++)
H = $ (echo "scale = 1; $ percent * $ I "| BC)
H = $ (echo" $ H + 0.5 "| BC | cut-D. -F1)
echo-ne "/033 [40; 1 hcopy table: T $ I ($ I/$ total) $ H %/033 [U/033 [1D "
usleep 50000
done
echo

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.