Reference documents:Summary of Shell interception string methods in LinuxHow does [Linux] calculate string lengths in shell scripts?There are eight ways to intercept a string, mainly for the following methodsThere are a number of ways to intercept
Shell result from CmdLineecho $?If 0 then success; else failure(Shell executes each return value, RM-RF error, package cannot overwrite)Solve Sudo:sorry, you must has a TTY to run sudo a few days ago encountered a problem, call another shell in one
#!/bin/bash##!/bin/bash#read-p ' input number ' C #指定抽取的学生人 Number of jw= (' Wang Hao ' Shei Yunsheng ' ke Yang ' He Shingyu ' Repeti soldier ' Dengbellin ' ' Liu Dao ' ' Yang Jidong ' Chu Ziwen ' ' ' Salted fish ' ' Yang Dong ' > Huang Tinghui '
Knowledge Points:1) Sleep: Used to implement the delay function in the script, sleep N, delay n seconds2) Tput: Change the terminal display characteristics, common usage is as follows:Tput lines: Displays the number of lines of the terminalTput cols:
For an even number of 100 or lessIdea: 1. Define a variable x firstThe range of 2.x is 0-50,x with an initial value of 13. And the value initial value is 0, each time the loop and the value is equal to itself +2*iMethod One:Vim
Sometimes it is necessary to start the project automatically after the start of the CentOS system, when the project is deployed in Tomcat, if the CentOS shutdown after the boot, the project has been stopped, and then need to be a manual to open each
In the production environment log is the operation and maintenance personnel to understand and analyze the production environment first-hand information, but the content of the log information is quite large, especially in the public cloud
In fact, I deliberately do not write the deletion of the section, because the management of the server will only add port will not shut down.=====================#! Bin/bashWhile:DoClearecho "Detect Open Ports:"Echo-e "\033[33m '
Turning off SELinux should be replaced with user input variables, but that's fine.==========================================#! Bin/bashClearecho "--------------------"Echo-e "\033[34mthis file controls the state of SELinux on the system.\033[0m"Echo-
Example 1. Enter any two numbers and make a judgmentVI number.sh#!/bin/bash#written by Lizhengecho "Please enter the number"Read aRead Bif test $a-eq $bThen echo "The No.2"Elif Test $a-gt $bThen echo "The > no.2"else echo "The Fi650) this.width=650;
Shell login mode, shell arithmetic operation, Shell logic operation, shell condition test, Shell selection statementShell programming in the first line indicates the path of the shell type to be executede.g #/bin/bash1. Shell Login MethodInteractive
Shell is the core program kernel outside the instruction parser, is a program, colleague is a command language and programming language--shell is a command parser, the user Input command, it to parse.Shell type ash,bash,ksh,csh,tcsh--cat
4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)
Shell is the core program kernel outside the instruction parser, is a program, colleague is a command language and programming language --shell is a command parser, the user Input command, it to parse.Shell type
The 1.expr command is generally used for integer values in the general format:Expr argument operator argumentThe general usage is to do arithmetic operations using expr, such as:[[email protected] ~]# Expr 10 + 2030$expr 30/3/25(Note that operators
1. Define variables: In order to avoid conflicts with environment variables, generally lowercase: such as pp= "mydql,kdkfeof";Second assignment scheme:The calling variable uses the $ symbol:Variable overlay:2. The output uses ECHO, as shown in:3.
The common input and output operators under the Linux shell are:1. Standard input (stdin): code 0, using 2. Standard output (STDOUT): Code 1, using > or >>/dev/stdout,/PROC/SELF/FD/1 1 for:/dev/stdout3. Standard error Output (STDERR): Code 2, using 2
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.