Assigning values to variables#定义变量, note that there is no space on either side of the equal sign variable=#定义环境变量Export variable=#双引号: Can contain spaces, can escape special characters variable="" #$ () or anti-quote: assigns a command
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).
#!/bin/sh/ETC/INIT.D/SNMPD start && >/dev/nullPid= '/ETC/INIT.D/SNMPD status| grep pid ' # '/etc/init.d/mysqld status| grep "not running" to see if the status of the service is healthy with the status stateIf ["$pid" = = ""]; Then
Guide
Unlike the Java, PHP, and other languages, the Linux shell has its own process control statements, including conditional statements (IF), loop statements (for,while), and SELECT statements (case). I'll use the example below to illustrate
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="
#for循环#格式#for variable in list#do# Command1# Command2# ...#doneA sequence of #列表是一组值 (numbers, strings, etc.), each separated by a space. Once per loop, assign the next value of the list to the variable#in list is optional, if it is not used, the
#字符串: As the number is the most commonly used type, the other is nothing to use.#字符串可以使用单引号, double quotes, without quotes.#单引号字符串限制:# 1. Any character is output as is, and the variable in single quotation marks is invalid# 2. Single quotes cannot
Basic format:Test expressionExpression constructed for the test command.Here expression is any valid expression that the test command can understand, and the simplified format will be the most common format that the reader may aiiowed seereturn
#输入输出重定向: Unix gets input from stdin by default, stdout output, input device is keyboard, output device is terminal#输出重定向: The clear output can be not only the monitor, but also the transfer to the file, which is called the output
As a result of the recent scripting, with exec, haha, today simply record a bit to deepen the impressionEXEC Execution ProgramAlthoughexecand theSourceis executed directly in the parent process, butexecthis andSourceThere's a big difference,Sourceis
Use directly after declaring variables in the shell:#! /bin/bashNa=zhagnsanag=11Echo ' $na is $ag years old 'Output: $na is $ag years oldecho "$na is $ag years-old"Output: Zhagnsan is one years oldTherefore, use "" in shell scripts to output
Shell operators: Arithmetic, Relationship, Boolean, string, file testNative bash does not support simple math operations and can be implemented with awk expr, which is most commonly used in expr.Expr is an expression evaluation tool that uses it to
1. Condition Judgment:If use:if condition; Then commands; fiIf else uses:if condition; Then commands; Else if Then commands; Else commands; fiDescription&&| | action; # If condition is false, the action is executed. && is the logic and operator, |
1. Shell Tutorial1. Shell TutorialThe shell is a program written in C and a bridge for users to use Linux. Linux is both a command language and a programming language.
A shell is an application that provides an interface through which users access
#数组: Bash supports only one-dimensional arrays, starting with subscript 0.#定义数组: Array_name= (value0 value1 value2), as follows1 array_name=(2value03value14value2 5 )#还可以单独定义数组的各个分量, a continuous subscript may not be used, and the subscript range
The purpose of this program is to execute shell scripts on the remote machine."Environment Parameters"Remote machine ip:192.168.234.123User name: RootPassword: rootPath to shell script:/home/ifilegentool/bakprovisionandoccurentrance.sh"Concrete
Hackers exploit this vulnerability to execute arbitrary code, even without the need for authentication, to remotely gain control of the system, including executing malicious programs, or implanting Trojan horses within the system, or obtaining
Suddenly want to find a place to write a little article, and think of this old account, not because of the long-term silence was deleted is very touched ... All right, let's just commemorate this. First day.I suddenly wanna write something and
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.