Pipe character
| Function: The output of the preceding command is given to the following command job control
CTRL Z pauses a task
[[email protected] ~]# vim 1.txt [1]+ 已停止 vim 1.txt[[email protected] ~]# vim 2.txt [2]
First, the alarm system main script[[email protected] ~]# cd/usr/local/sbin/# #脚本基本都放在这个文件夹下, convenient management [[email protected] sbin]# mkdir mon## Create a monitoring script home directory [[[email protected] sbin]# CD mon[[email protected]
One, character interceptionExprBasic usageExpr substr $var 1 starting position for the length of the Intercept, such as:[Email protected] mnt]# a=centos6.9[Email protected] mnt]#[[email protected] mnt]# expr substr $a 1 6CentosCutBasic usage:Command
First, special symbols' * ' wildcard character, any of any characters'? ' any one character' # ' comment characters' \ ' de-semantic characters' | ' pipingThe prefix of the ' $ ' variable'!$ ' combination, regular inside means end'; ' multiple
1. The concept of variables: variables are stored in the program of the user's memory space, the variable name is the address of this memory space, the value of the variable is stored in the computer memory. Variable definition: It is simple to
Pipe character and job controlPipe characterThe pipe character means that the output from the previous file is passed to the following command. To display the number of files in the current directory:`Job ControlCtrl Z pauses the current task (can
A variable in a shell script means that the command itself can represent a soft connectionShell variablesParentheses can only affect variables in parentheses because the parentheses open the child shellCurly braces affect variables outside the
1, shell command commonly known as "shell", it provides a user interface with the kernel to interact with, he accepts the user input command and sends it to the kernel to execute 'The shell is actually a command interpreter that interprets the
Test condition judgment# symbol [] equals test commandTen 5 # Judging the size of echo $? # View the previous sentence The test command returns the status "hello" # To determine if the string length is 0[$ 0"success" | |
I. Historical order History #查看历史命令 history-c #清空历史命令 history-w #不等退出, write the history command in the cache directly to the history command to save the file ~/.bash_history vim/etc/profile #默认历史命令保存1000条, can be modified histsize save the
1 ${bash_source-$0}Represents the full path of the currently executing script.2 cd-p enters with physical path/usr/localhadoop now chains to the/home/houzhizhen/usr/local/Hadoop/hadoop-2.72
Exit (0): Run the program normally and exit the program;Exit (1): Abnormal operation results in exiting the program;Exit 0 can tell the user of your program: Your program is finished properly. If exit is not a value of 0, then the user of your
Because of the need for plaintext to display passwords in the script, the idea is to encapsulate the already edited shell script into a binary executable file.Using the tool SHCOfficial Download site: http://www.datsi.fi.upm.es/~frosal/Use the
#!/bin/bash: Program:NFS Server installbr/>[email protected]20171129 v1.020171130 v1.1 Modify the following:1. Cancel the grep "style" file &>/dev/null if [$?-ne 0];then Usage, modify to if grep-q "style" file; then method2, all changed to function,
Overview of the use of parentheses in the Linux shell 本文主要介绍Linux中括号的用法,主要包含判断文件和变量。**注意事项**:中括号两边必须有空格。The knowledge involved in using brackets &&, | | | 在本文对文件或者变量做判断的时候,可能会多次使用到&&和||这两个符号,所以在我们进入中括号的学习之前首先了解一下这两个符号的作用。 &&:
method One: Switch toShellthe directory where the script is located (at this time, called the working directory) executesShellScript:Cd/data/shell./hello.shThe./ means to execute hello.sh under the current working directory . If you do not add
Shell programming is actually a program that combines multiple commands, based on bash.Serious attentionThe difference between $hostname and $ (hostname)$hostname is to take the value of the hostname variable$ (hostname) is the execution result of
Pstree-p #显示进程编号 (tree) echo $$ basic structure of #显示当前shell进程编号 scripts: #! Shebang (indicates what shell is used to open a file, typically using bash) configuration_variables #定义变量FUNCTION_DEFINITIONS # define function Main_code #主要执行命令
DirectoryI. Condition selection: If statementTwo. Conditional judgment: Case statementThree. For loopI. Condition selection: If statement
Single Branchif judgment condition; thenBranch code with true conditionFiExample: Judging whether a number
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