8.1:shell Introduction:The shell is a command interpreter that provides interaction between the user and the machine, supports specific syntax, supports logical judgments, loops, and each user can have his or her own shell:The CentOS default shell
1. Export path= $PATH:/usr/local/mysqlPut the $path in front, or to add to the path inside of the way to write the wrong words, you are tragic, processing is still more troublesome2. crontab inside Execute script remember Source/etc/profileCrontab
Shell ScriptStandardize the general composition of shell scripts#! Environmental Statement (Sha-bang)# comment TextExecutable codeConsiderations for setting variablesIf the specified variable name already exists, it is equivalent to re-assigning a
2. Case statementOnly one conditional relationship is judgedGrammar:Case¢ variable name in"Value 1")Procedure 1;;"Value 2")Procedure 2;;*)Procedure 3;;Esac3. For loop1) Syntax: (Assigning a value to a variable executor, several values are executed
Basic Regular expression:A regular expression differs from a wildcard character:A regular expression is used to match a string in a file that matches a condition, and a regular contains a match. grep, awk, sed, and other commands can support regular
First, the basic knowledgeHere you'll learn about shell fundamentals and some of the knowledge points.Concept: The shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the command
^ matches only the beginning of the line$ matches end of line only* A single character immediately after the *, matching 0 or more of this single characters, it can also be a sequence. You can use-to represent a range of character sequences within []
In operation and maintenance work, we should analyze the log of back-Office system frequently, and provide the basic data for the monitoring result by grasping the key word information in the log and counting the fetch results.The following shell
Comm CommandUsage scenarios:Requires a common list of records for two files or a list of records that appear only in the first file but do not appear in the second fileHow to use:Must be sorted first, that is, sortParameters1 shows columns in the
Data Flow redirection: is a command that should appear on the screen after the data transfer to other places.Standard input (stdin): code 0, using Standard output (STDOUT): Code 1, using > or >>;Standard error Output (STDERR): Code 2, using 2> or 2>>
The first shell program runs, tutorial from: http://jingyan.baidu.com/article/8cdccae947f83e315413cd05.htmlThe code is as follows:1 #!/bin/sh2touch a.txt3sleep4 echo"testtesttesttest">>a.txtI don't know why. Tip: MSYS2 terminal has stopped working.
#!/bin/shEcho-n "Login:"Read nameEcho-n "Password:"Read passwdIf ["$name" = "AA"-a "$passwd" = "AAA"];thenecho "right!"else echo "Error"FiOne. the problem with [: missing '] in the running process is ["$name" = "AA"-a "$passwd" = "AAA"] "$name"
ll command to view file informationThe first root represents the creator of the file, and the 2nd root represents the group root that the file belongs toRWX delegate Rights R (read) permission, W (write) write permission, x Execute permission,
1. View Memory usageFree-m2. View drive Information usageFdisk-l3. View CPU and Memory usageTop4. View CPU Information commandsCat/proc/cpuinfo5. View memory InformationCat/proc/meminfo6. Modify the IP
Original documents, welcome to read, Forbidden reprint.In the example, the "yes" in the previous line of the finish is changed to "yes"One way to do this is to use Sed+awk together.[Email protected]:~$CatA.txtline0is yesline1is yesline2is yesline3is
The shell script is an operation of the basic skills of personnel, in peacetime work, in order to deal with some anomalies or query data, I often have to write shell scripts automated processing.Here to share a script I wrote to detect the status of
Install Putty.exe, the following EXE files are installed in the installation directoryCreate File Put-file-mobile.txtRM Mobile.warput D:\SVN_LZY\dragon-tour-2_1\lzy-mobile\target\mobile.warexitCreate a batch file release-mobile.batPsftp.exe [email
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.