BASH Shell simple progress bar small function, bashshell

Source: Internet
Author: User

BASH Shell simple progress bar small function, bashshell

Not to mention, directly add the script.

# processbar <current> <total>processbar() {  local current=$1; local total=$2;  local maxlen=80; local barlen=66; local perclen=14;  local format="%-${barlen}s%$((maxlen-barlen))s"  local perc="[$current/$total]"  local progress=$((current*barlen/total))  local prog=$(for i in `seq 0 $progress`; do printf '#'; done)  printf "\r$format" $prog $perc}# Usage(Client)for i in `seq 1 10`; do  processbar $i 10  sleep 1doneecho ""



Bash shell Command

At ---- schedule, check, and delete jobs in the queue
Cat ---- connect the file and print it to the standard output
Cd ---- Change directory to be able to process absolute and relative paths
Chmod ---- change the file protection permission
Chown-change the owner and group of Files
Clear ---- clear the screen (like cls in DOS)
Cp ---- copy an object
Crontab-operate the daemon and execution schedule of each user
Date ---- print or set the system date and time
Dd ---- copy an object (and convert it at the same time)
Df ---- report the remaining disk space
Du ---- report disk space usage
File ---- test file and directory types
Find ---- search for files in a directory
Grep ---- search for matched rows in the file and Output
Gzip-compress or expand a file
Head ---- display the first few lines of the file
History ---- display historical Command records
Kill ---- abort a process
Last ---- shows how many users or terminals have logged on to the machine
Less ---- you want to use the more command to display files by PAGE
Ln ---- establish a connection Between Files
Ls ---- list files in the current directory
Man ---- display online manuals with certain formats
More ---- the command can read the text page by page
Mount ---- install a File System
Mv ---- rename the file
Passwd ---- set the User Password
Ps ---- command to list Running Processes
Reboot ---- restart the system
Rm ---- command used to delete files
Su ---- create and edit Unix archive files
Tar ---- create and edit Unix archive files
Touch ---- change the time parameter of the file
Wc ---- count the number of bytes, number of words, and number of rows in a file
Who ---- view other login users
Which ---- which -- display the full path of the command
Ping ---- command-determine whether the machine on the network can reach or reach the speed
Multi-task
Output redirection
Understanding processes

--------------------------------------------------------------------------------

In Linux, there are two operation interfaces: X Window mode (KDE by default) and Console mode (Console ). The two interfaces are similar to Windows and DOS.

If you want to change to Console mode in X Window mode, you only need to press Alt + F1 (or F2... F6) key. A new waiting window will appear on the screen. You can log on to the system again in Console mode. If you want to return to X Window mode in Console mode, press Ctrl + Alt + F7 at the same time.

If the X Window mode is not enabled and you want to start the X Window mode from the console mode, enter startx (or kdm) in the Console mode to start the X Window.

In the above two chapters, we have introduced the operation of the X Window (KDE by default). In this chapter and the next chapter, we will mainly discuss the operations in the Console mode, the corresponding KDE operation will also be inserted between them.

6.1 start and close the system
Start the system
If you have installed LILO during the installation process, you can start the system. When LILO is started, the screen displays:

LILO:

Click the Tab key to display all operating systems that can be started. Enter the name of the displayed operating system to start the corresponding operating system. Type Linux to start BluePoint Linux & 127. If you press the Enter key directly or wait for 5 seconds, you can also start the BluePoint Linux & 127; operating system.

Another way to start linux is to run the command in DOS/WINDOWS... the remaining full text>

Bash shell programming -- function call -- add 20 ps)

The input rename takes effect, but the parameter should be included when calling rename, because $1 in the function is not the same as $1 outside the function.
Rename $1 $2 ;;

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.