Shell's advantage: You can call Linux system commands directlyBasic syntax for shell scripts:Script name ends with. shThe first action of the program #!/bin/bash, tell the system this is a shell scriptWith # as a commentHow shell scripts are
== : Two strings are equal! =: Two characters not equal> : Whether a string is greater than another string : Whether a string is less than another string- N String : Tests whether the specified string is empty- s string : Tests whether the
1, in the assignment statement Name=value can not have a space, for example: name = value of the form is considered to be three variables, because essentially, the content of the script is passed to the shell program variables, and the variables are
Recently, follow the MIT operating system engineering Course (6.828/fall 2014) to write a simple operating system from scratch.Job 1 of the first lesson is to write a simple shell that can run the command and Support redirection (' > ', ' The source
I am not clever and understanding something are not quick. Even so,i can ' t be scared for facing it. Practice more and practice more. Don ' t stop your passion.
Recently to work on GitHub with small partners to do projects, my github ....
Remove the first two columns from the a file and match the other file to print out the matching line from=$1compare=$2tofile=$3f1s= ($ (cat $from |awk-f ' \ t ' "{print $")) f2s= ($ (Cat $from |aw K-f ' \ t ' {print $} ') #for i in ' seq 0 ${#f1s [
Set foot name as Test.shThe first line should be #! /bin/bash1, the operation and debugging results are not the sameDebug Sh-x test.sh when calculating two-digit and sum=$[$a + $b] to get sum=3+4 instead of 7Run to give script execution permission
Objective
How did grep get out?It's going to take us discovering, "g/re/p" see, that's it. "Global Regular expression print" ==> "globally finds the regular expression (RE) and prints the resulting row. ”The grep family consists of commands
(1) rsync (remote synchronize) is a data synchronization tool that allows you to quickly sync files between multiple hosts via Lan/wan, or use rsync to synchronize different directories on your local hard drive. (2) Rsync is a tool for replacing
Shell Bash determines whether a file or folder exists1, #如果文件夹不存在, create Folders folder="Log"if[!-D"${folder}" ]; Then mkdir ${folder}fi2To determine if a file exists.="/var/www/log.txt"# -The f parameter determines whether the $file
#!/bin/bashcd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} 'If [$CD-ge 20];thenecho " hard disk space is full and cannot be backed up " | Mutt-s " backup alarm, please replace the hard drive in time " [Email
There are three main ways of running shell scripts in Linux:1. Direct command release: The shell.sh file must have readable and operational (RX) permissions, and then:Absolute path: Use/home/dmtsai/shell.sh to release commands;Relative path: If the
Linux Login Server Knock command too much, at some point it is inconvenient, so the shell wrote aI. Description
Supports both secret and key formats
The user name and password are both written and saved in clear text
Two. Configuration
1037774765 cloning1. Create a user redhat with an ID number of 1001, a basic group like (Group ID 2002), and rent it near Linux.Groupadd-g 2002 LikeGroupadd LinuxUseradd-u 1001-g 2002-g Linux Redhat2. Create a user fedora with the note information
Write a script that calculates all the odd and all the even numbers within 100 and displays them separately#! /bin/bashSum1=0For i in ' SEQ 1 2 100 'Dosum1=$[$sum 1+ $i]Doneecho $sum 1Sum2=0For j in ' SEQ 2 2 100 'Dosum2=$[$sum $j]DoneEcho $sum
Reference: http://www.cnblogs.com/chengmo/archive/2010/09/30/1839632.htmlCreate an arrayA= (12345)Get array length${#a [@]} #${#变量} to get variable length ${#a [*]}Print array ContentsEcho ${a[@]} #echo $a print only the first element of the
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.