Shell Script--sed Tool

SedSED: it is called a streaming editor, and its working scenario is typically in the editor, where a piece of text is read in the SED in a row and then output in the specified way, which is its most basic usage.First, the basic operation of

Talk about export and Source,bash in shell scripts.

Little brother just contact Linux, a lot of things on Linux is more unfamiliar, so write a blog, as their work summary and technology accumulation bar, but also spur their efforts to learn.The reason for today's title is to put Export,source, Bash's

Shell Scripting Exercises

First, using the shell script to implement the progress bar#!/bin/bashfunction proc ()   4 {  5     count=0   6     bar= ""   7     lable= ("|"   "/"   "-"   "\")   8     while [  $count  -le  100 ]  9     do 10              let index=count%4 11     

Shell scripts: Exercises

Topic 1:1-100 summationNon-recursive version:#!/bin/bashsum=0while [$val-le]dolet sum+=vallet val++doneecho $sumsum =0for i in {1..100}doif [$i = = 1]; Thenbar=${bar}${i}elsebar=${bar}+${i}filet Sum+=idoneecho $bar = $sumsum =0for ((i=1; iOperation

Use Shell to modify IP aliases for ansbile host files

#需求Original content 10.221.29.30 modified: qq1-5f ansible_ssh_host=10.221.29.30Original content 10.225.32.75 modified: qq6-10f ansible_ssh_host=10.225.32.75Original content 10.221.249.127 modified: qq11-15f ansible_ssh_host=10.221.249.127#文件展示[Email

Shell---related simple program normalization

1, 1-100 number summation① non-recursive methodShell650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/83/0B/wKiom1dpIcHBcRrUAABevxRp8l8674.jpg "title=" Sum1.jpg "style=" Float:none; "alt=" wkiom1dpichbcrruaabevxrp8l8674.jpg "/>Operation

[Shell Foundation]--read Command

Read command: Primarily used in the shell to read input, variables, text1. accept input from the standard input (keyboard) and assign the input data to the SET variable"Press Enter--indicates that the input is complete""If more data is entered than

Start the ultimate Efficiency Shell Tour (1)

An efficient development environment is undoubtedly of great help to our daily work, and time is saved by these tiny details.Next, I'll show you how to configure ZSH+INCR to create the ultimate and efficient development environment.First, let's look

Shell script: The Interception of strings

In shell scripts, all of our variables are stored as strings. So it becomes very important for the interception of strings.In a shell script, if you want to specify a string for interception, there are several ways to do it:The following examples

The shell command loops through the directory to match the keywords

#!/bin/bashwhile read Linedo for file in/home/local/test/* does if test-f $file then sed-n "/${line }/p "$file >>/home/local/out.txt fi Donedone Task: To file from the Home/local/test folder belowFile_1.logFile_2

Shell script Programming

650) this.width=650; "title="%]bw ' BI7 ') 2O) 8$ @MNDGKKM. png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M00/ 83/11/wkiol1dqljdcexdmaaaonuc13sa029.png-wh_500x0-wm_3-wmp_4-s_2178205859.png "alt=" Wkiol1dqljdcexdmaaaonuc13sa029.png-wh_50

A method of string interception by the shell

Linux There are eight ways to intercept a string. Suppose there is a variable var=http://www.aaa.com/123.htm.1. # Intercept, delete the left character, leave the right character. The code is as follows:Echo ${var#*//}where var is the variable name

2nd Chapter into the shell

several termsMute terminal (dumb terminal):A dumb terminal was usually nothing more thanA monitor and keyboard connected to the Unix system via a communication cable (usually a multiwireSerial cable multi-line serial cable, also called ribbon cable).

"Shell" conditional judgment

expression format for conditional judgments:File Judging type:[[Email protected] ~]# [-E/ROOT/1] && echo yes | | echo no #注意 [] inside the space, the first command is true print Yes, otherwise print noyes[[email protected] ~]# [-F/ROOT/1] && echo

Shell script Programming Exercises

Create loops in shell scripts to append echo content redirection to a file650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/E7/wKioL1dj6XHwzJ-tAAAoItNjmwc457.png-wh_500x0-wm_3 -wmp_4-s_2295541797.png "title=" qq picture

Shell Script Application Applet

The summation of 1...100Non-recursive:   #!/bin/bash read num count=1 sum=0 val= ""  ret= ""  while  [  $count  -le  $num  ] do    if [  $count  -eq   $num  ];then        val= $count     else         val=${count} ' + '     fi   

3 ways to redirect Shell files

Three ways:1.While Read lineDoDone2.For line in ' cat filename 'DoDone3.Cat FileName | While Read lineDoDoneCases:Reads data from the Math_file file, outputs the maximum, minimum, and average values1.650) this.width=650; "src="

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"

Basic algorithm programming for shell scripts

First question: Recursion and non-recursion of Fibonacci sequencesNon-recursive:650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/82/EF/wKiom1dl-8rD92igAAB-pImrC88891.png-wh_500x0-wm_3 -wmp_4-s_582408408.png "title=" series non-recursive

Total Pages: 541 1 .... 424 425 426 427 428 .... 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.