3rd Chapter Basic Bash Shell commands (2)

Create a fileYou will always encounter situations where empty files are created. Sometimes the application wants a log file to exist before they can write the data. At this point, you can easily create an empty file using the Touch command.Touch

Progress bar--shell Script implementation

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

Shell Script Implementation progress bar

Using a shell script to implement a progress barThe code is as follows:650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/DC/wKiom1dirnXDvyV1AAA-ATqC6Jg995.png-wh_500x0-wm_3 -wmp_4-s_4061727919.png "title=" progress bar. PNG "alt="

How to execute a shell script

There are 3 ways to execute the shell script: Bash xxxxx.sh or SH xxxxx.sh (recommended) Path/xxxxx.sh or./xxxxx.sh (Execute script under current path) SOURCE xxxxx.sh or. Xxxxx.sh (there is a space behind the dot.) This way you can put

Shell text filtering

Regular expressions Symbol p> meaning . Matches any single character in any ASCII, or letter, or number ^ Match beginning $ Match line end

String interception under Shell

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/82/E0/wKioL1djmxjx5LUrAACG8N3z-pA754.png "style=" float: none; "title=" 0.png "alt=" Wkiol1djmxjx5luraacg8n3z-pa754.png "/>The maximum, minimum, and average values of a set of numbers are

"Shell" multi-Command execution order

; for example[Email protected] ~]# date;dd if=/dev/zero of=/home/1 bs=1k count=10240;date # #统计dd命令消耗时间, where/dev/ Zero empty file Tue June 15:15:02 CST 201610240+0 Records in10240+0 records out10485760 bytes (ten MB) copied, 0.0224696 s, 467 M

Shell detects network status scripts for entire network segment IP by pinging

To achieve ping a network segment of all the IP, and detect the network connection status is normal, many methods can be implemented, the following is a brief introduction of two, as follows:Script 1#!/bin/sh# Ping Network segment all IPs# 2012/02/05

String interception of shell scripts under Linux

1 #!/bin/bash23 str= "Http://www.baidu.com/test.htm"45 #echo ${str}The result of the operation is:http://www.baidu.com/test.htmMethod One: #截取, delete the left character, leave the right characterEcho ${str#*//}#*//means to delete the first//number

Learn the shell script every day.

---restore content starts---Primary stage:--File operation:--Document as a whole: increase, delete, copy, move;--File content: Append, overwrite, empty;--Regular expression:--String:--interception, splicing;echo "ABCD" > ShellTest.log: Writes "ABCD"

Shell 10 a good habit

Michael Stutz, author of the Linux Cookbook, has summed up 10 good habits with his many years of experience in using UNIX, and personally believes that it is really useful, and is summarized below to share with you.1. Create a hierarchy directory:

Shell Note 2 Tput

Shell ArrayCommand_list= ([add]= ' Add '[del]= ' Delete '[edit]= ' Modify '[query]= ' query ')Get index: ${!command_list[*]}, according to the index submission value, perform the corresponding operation.Get length: ${#command_list [*]}, traversing

Shell Initial involvement

I. Concept:The shell, commonly known as the shell (used to distinguish it from the kernel), is a command-line interpreter that receives user commands and then invokes the appropriate application. Two. Type of shell:1. SH (Bourne Shell):

Shell Special Symbols

*-----Wildcard (multi-bit)?-----wildcard character (one bit)#-----Comment (Explanatory Note)\-----caret (\ #1. txt, let #1.txt become a file name, so that the special symbol behind the loss of meaning)|-----Give the result of one command to another

Shell Common Commands

Tag: TR WC split cutCut interceptCut-d:-f+ number + file to take the first paragraph of the file, with a comma between multiple numbersCut-c intercept the first few characters (3-5 3 to 5)Sort sorts-T delimiter-U to repeat-N Sort by number-K

Shell Grammar Learning Chapter

Escape characters:650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/B1/wKioL1dekCOAJOxMAADJVCjDcdk147.png "title=" QQ picture 20160613180543.png "style=" Float:none; "alt=" Wkiol1dekcoajoxmaadjvcjdcdk147.png "/>When parsing text, double

Linux Gvim Shell variables

#!/bin/bashName="Matto" #变量名和等号之间不能有空格 #name="Blog4matto" #重定义name变量 #readonly name #设置name为只读变量 # unset name #删除变量, you cannot delete a read-only variable #${name}

The shell gets the data from the file and assigns it to the variable

Requirements: Read IP addresses and port numbers from a file, open the IP and ports with Iptablessuch as file content:[email protected] huwei]# cat ip.txt192.168.66.20 22192.168.66.30 10050192.168.66.30 33The manual action is:[[email protected]

Shell aliases, pipelines, user profiles, variables, read

I. Shell BasicsCat/etc/shells the shell that the current operating system can useWhat is a shell?A text file that implements a function that has permission to executeCommand-line InterpreterBuilt-in commands (commands provided internally by the

Linux Shell: The simplest system backup script in history

#!/bin/bash# the is script backup /etc directory! # author: zhangjun  (e-maill: [email protected]) date=$ (date +%y%m%d) size=$ (du -SH/ETC) if [ -d /tmp/dbbak ]         then                echo  "date:  $date!"  > /tmp/dbbak/dbinfo.txt              

Total Pages: 541 1 .... 470 471 472 473 474 .... 541 Go to: GO

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.