SED: Line processing command, default does not modify the original file, only the data in the pattern space to do processing, after processing, the mode space to print to the screensed [options] ' addresscommand ' file ...-N: Silent mode, content
The format of the IF in the shell:If [conditions]ThenExprelif [conditions]ThenExprElseFi[Conditions] includes1.!,-A,-o2.-n,-z, =,!=3.-eq,-ge,-gt,-le,-lt,-ne4.-ef,-nt,-ot5.-b,-c,-d,-e,-f,-g,-g,-h,-k,-l,-o,-p,-r,-s,-s,-t,-u,-w,-xType 1 is a logical
I. What is a shell? 4.shell provides a way for you to communicate with the operating system. There are two kinds: a.Interactive mode:(Input from the keyboard and can be immediately responded to) in fact, one command is entered at a time;B.
title:createlivecmsv4.0 vulnerability, no background get shell--2012-03-06 17:28Title: createlive CMS Version 4.0.1006 Vulnerability without background Get shellRequired environment: IIS6, upload directory executable scriptCreatelive CMS Version 4.0.
Special characters in shell pattern matching
*
Matches any string (including an empty string).
?
matches any single character .
[...]
Matches any character that is contained.
#!/bin/bash#演示全引用和部分引用#双引号和没引号的区别variable1=2010echo "$variable 1"echo $variable 1variable2= "x y z" # #字符之间用多个空格隔开echo "$variable 2" # #双引号echo $variable 2 # #没引号#单引号和双引号的区别echo "$PWD is the current directory." # #双引号Echo ' $PWD is the current
tar [-cxtzjvfppn] files and directories ....Parameters:-C: Create a compressed file parameter directive (the meaning of Create);-x: Unlock the parameter instructions for a compressed file!-T: View the files inside the Tarfile!In particular, in the
#! /bin/shA= "Hello World"echo "A is"Echo $aecho ""echo "A is $a"Results of the output:A isHello WorldA is Hello World2 Getting the system time:Get today's period: ' Date +%y%m%d ' or ' date +%f ' or $ (date +%y%m%d)Get yesterday's period: ' Date-d
A few examples of shell scripts, feel good." Example: 001 " judging the input as a number, character or other #!/bin/bashread-p ' Enter a number or string here: ' Inputcase $input in [0-9] ' echo-e ' good job, Your input is a numb eric! \ n ";
1. Issues to solveWhen you need to enter a number of commands at once , such as deleting files in multiple directories at onceCD Dir1RM file1.tempCd.. /.. /dir2RM-RF Dir3When you are too lazy to enter a good long command or simply can't remember
Positional variables$ A Gets the file name of the current user script contains the path$n gets the nth parameter of the currently executing shell script if n is greater than 9 in curly braces ${10}$# gets the number of arguments for the currently
There are a number of ways to intercept strings in the shell, and there are 9 ways to use ${expression. ${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word} The above 4 alternatives can be used for default values. ${#parameter}
When writing a shell script today, one of the actions is to use the grep command to search for the specified content in a file. Specifies that the content is stored in a file, using a variable to get the contents of the file, and then uploading to
IntroducedBefore I had a blog post that describes how to automate Hadoop decommission with Ansible playbook, this article describes using shell scripting.The scripts are placed on the springboard machine, and the remote server calls the local script
Numerical comparison:N1-eq n2 Check if N1 equals N2 n1-le n2 check N1 is less than or equal to N2N1-ge n2 Check if N1 is greater than or equal to N2 n1-lt n2 check N1 is less than N2N1-GT n2 Check if N1 is greater than N2 N1-ne N2 check N1 is not
The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current
Return values of functions in Shell#! /Bin/shSum (){Echo $($1 + $2 ))Return $($1-$2 ))}Sum $1 $2C =$ (sum $1 $2)Echo $?Echo $ cRun the command:./bashTest 11 1.The running result is:12 -- result of sum $1 $210 -- echo $? Because the return value is 10
Introduction to Sed Regular Expressions in Linux shell scripts, shellsedSed IntroductionSed is a lightweight stream editor, short for stream editor. Sed is also called a row editor because it is used to edit a file in a behavior unit. It can
Shell script programming 2
Custom environment variables (global variables)
Set Environment Variables
If you want to set environment variables, you must use the export command after assigning values to the variables or setting the variables, declare
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