Standard input and output
Three standard files are usually opened automatically when executing a shell command lineThe standard input file (stdin), which usually corresponds to the terminal's keyboard, the standard output file (stdout), and
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.
First, Shell introduction
The
Shell is a command interpreter that provides interaction between the user and the machine
supports specific syntax, such as logical judgment, looping
each user can have their own specific shell
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
#/bin/bash# definition of Nginx Source package version, the script will check whether the file is in the current directory according to the version name and suffix if you need to install different versions of Nginx can modify these two variables
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
There are three standard input and output in Linux, namely Stdin,stdout,stderr, the corresponding number is 0,1,2.STDIN is a standard input that reads information from the keyboard by default;STDOUT is the standard output, by default output output
I will regularly collect some good shell and PY scripts to see here, for reference learning:Shell resources:Https://github.com/lannyMa/ops_doc/tree/master/LazyManageCheck Help
Chinese Culture sh
yum install man-pages-zh-CN -yecho 'LANG=
I. Shell INTRODUCTIONThe shell is a command-line interpreter for Unix/linux, and a series of commands executed by the user in the shell are executed directly by the shell command-line interpreter. Modern, popular command-line interpretation features
Environment:Kali system, Windows systemProcess:In the Kali system generated by the use of files, Kali system listening to the local port, Windows system open DOC file, you can recruit The first method of use, suitable for testing:Download code from
Python2:To open a terminal, enter the following command:[Email protected]:~$ vim helloa.pyIn the Vim editor, enter edit mode (press i), enter the following code, and then exit edit mode (press ESC), save the file (press shift+ semicolon, and then
When doing performance testing, Linux server often generates a lot of data, such as log information, picture information, file information, and so on, after a period of time, causing the server disk space is full and crash, daily manual cleanup more
Starting with this blog, we'll go into the Linux shell Script learning, which is particularly important for Linux learning enthusiasts and a particularly interesting section, as well as the shell script, like the java,php-like programming language
Often encountered in the file has a duplicate record of the scene, either remove duplicate records, or count the number of duplicate records, these simple functions can be implemented through the Sort,uniq combination of shell commands,For example,
How can I implement real-time alarm functions through shell scripts and enterprises ?, Shell Information
At work, we will have some applications running on the server online, so these applications have problems. For example, after the memory and CPU
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service