Simple progress bar for shell scripts

Source: Internet
Author: User

The basis of a simple progress bar

1. Arrays

Bash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays. Similar to the C language, the subscript of an array element is numbered starting with 0. Gets the elements in the array to take advantage of subscript, the subscript can be an integer or an arithmetic expression whose value should be greater than or equal to 0.

Define an array: In the shell, the array is represented by parentheses, and the elements of the array are separated by a "space" symbol.

The general format for reading array element values is: ${array_name[index]}.

The general format for reading all the values of an array element is: ${array_name[*]} or ${array_name[@]}.

Find the length of the array:${#array_name [*]} or ${#array_name [@]}.

2.while Cycle

Format: while [condition]

Do

.

.

.

Done

The while loop starts with do and ends with done.

Second, the code implementation and results

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/85/A4/wKiom1eqz3rz6__hAABR-IY-f48019.jpg-wh_500x0-wm_3 -wmp_4-s_631630572.jpg "title=" 36020160810145313816.jpg "alt=" Wkiom1eqz3rz6__haabr-iy-f48019.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/85/A3/wKioL1eq0O-zSxECAAAUt41utHI650.jpg-wh_500x0-wm_3 -wmp_4-s_1565269052.jpg "title=" 36020160810145927968.jpg "alt=" Wkiol1eq0o-zsxecaaaut41uthi650.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/85/A4/wKiom1eq0NKzBy6aAAA1OCpyJsk865.jpg-wh_500x0-wm_3 -wmp_4-s_156628750.jpg "title=" 36020160810145907024.jpg "alt=" Wkiom1eq0nkzby6aaaa1ocpyjsk865.jpg-wh_50 "/>

This article is from the "11441519" blog, please be sure to keep this source http://11451519.blog.51cto.com/11441519/1836555

Simple progress bar for shell scripts

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.