First, function definitionThe Linux shell can be user-defined functions and can be called casually in shell scripts.The functions in the shell are defined in the following format:function ] Funname [()]{ action; int ;]}Description
1,
English original link: https://www.lopezferrando.com/30-interesting-shell-commands/1. Monitoring commands (run every 2 seconds)"ls -larth"2. Kill the program with one portsudo fuser -k 8000/tcp3. Limit the memory usage of the following
1. Needs and ideasRequirements: Use the shell to customize a variety of personalized alarm tools, but the need for unified management, standardized management.Idea: Specify a script package that contains the main program, subroutine, configuration
[From]Https://www.zmrbk.com/post-2030.html40952771My understanding is that if the problem described in title occurs, it is because of the combined effect of using different shell programs and corresponding stty to set the corresponding
Shell Command Application Exercise(1) The use of the following documents is briefly reviewed through the Help information/ETC/PASSWD records the user's account/etc/shadow is an optional encrypted password file (view requires sudo
[TOC]Shell programming One, Shell script introduction
The shell is a program written in C that is a bridge for users to use Linux. The shell is both a command language and a programming language.The shell is a scripting language;Can use
20.1 Shell IntroductionShell is a scripting languageYou can use logical judgments, loops, and other syntaxCustomizable functionsThe shell is a collection of system commandsShell scripts enable automated operations, which can greatly increase our
Shell script +expect deploying SSH in bulkFirst, the preparation of work and ideas1, three machines to do experiments (centos6.5, ip:192.168.0.22 (master control), 192.168.0.156, 192.168.0.157)2,ip:22 this one control machine, the other 2 do the
1. When type cycle and until type cycleWhile using a few, the general daemon program or always loop execution will be used, the other loop operations are used for instead.1.1 Type and until type loop syntax(1) While conditional
While and for are circular statements, relative, the For loop uses a bit more. But the while loop is especially useful when reading a file line.While formatwhile [ 条件 ]do 内容done
Example: Determine if I is small and equal to 5, if less than
If one, if base 1, single branch 1.1 syntaxif语句语法 单分支结构语法: if [条件]; then 指令 fi 或 if [条件] then 指令 fi1.2 Examples[[email protected] day4]# cat if-single1.sh #!/bin/sh#功能:单分支if结构整数比较,用-lt格式例子#created by
Shell syntax Shell performs command operation
When the shell reads the input, it performs a series of actions. If the input represents the beginning of a comment, the shell ignores the comment symbol (' # ') and the remainder of the line.
One, the string slice:${#var}: Returns the length of the string variable var${var:offset}: Returns the string variable var starting with the character specifier (excluding the first offset character) from the first, to the last part, where the value
The wildcard asterisk number (*) represents a question mark (?) that matches 0 or more characters. Represents a matching single character in parentheses number ([0-9]) that represents a single digit character between matching 0~9 brackets plus the
Important notes about the function:When executing the Shell function, the function name and the parentheses after the function name are not required;The definition of a function must be defined or loaded before the executing programThe execution
A wildcard character? Unit # blocked command \ Screen symbol| Pipe character $ use variable ~ Home directory & put behind
>> 2> 2>>Error redirection[] Array
Cut segmentCut-d:-f 3, 4 charactersFiles under three and four columns-C Line-F
Trap commandtarpThe command is used to perform the action after the specified signal is received, usually in order to complete the cleanup when the shell script is interrupted. For example:When the script is pressed at execution time CTRL+c ,
20.16/20.17 functions in the shellImplicit functions for displaying variablesResults of executionparameter is only one 1, the result of the first is 1, the second is empty, the third is empty, the name of the limb is fun1.sh, a total of 1
1. Basic IdeasHill sort is to group records by a certain increment of the subscript, sorting each group using the direct insertion sorting algorithm; As the increments gradually decrease, each group contains more and more keywords, when the
Shell: Shell Process Control details, shell Process Control detailsShell: Shell Process Control details if else
If statement
Syntax:
if conditionthen command ...fi
Eg:
#!/bin/basha=100b=100if [ $a == $b ]then echo "$a == $b"fi
Output:
100 ==
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.