Example 1:[Email protected] example]$ more trapping#!/bin/sh# scriptname:trapping# Script to illustrate the trap command and SignalsTrap ' echo ' ctrl-c would not terminate $. "' 2Trap ' echo ' ctrl-\ would not terminate $. "' 3echo "Enter any
TRL key combinationCTRL + A: The cursor moves to the beginning of the line.CTRL+B: The cursor moves left one letterCTRL + C: kills the current process.Ctrl+d: Exits the current Shell.Ctrl+e: The cursor moves to the end of the line.Ctrl+h: Deletes
A string interception of Linux is useful. There are eight ways.Suppose there is a variable var=http://www.hao.com/123.htm1 # Intercept, delete the left character, and leave the right character.Echo ${var#*//}where Var is the variable name and the #
Escape: a backslash (\) is placed before a character that needs to be escaped, indicating that the character is to be treated as a normal character.The escape character is occasionally used when using sed awkFor example, I insert a string from line 8
1:shell Basics:Learning about Linux is known to have a shell concept, the shell is between the user and kernel, the user's operation or instruction through the shell interpretation passed to Kernel,kernel can understand and perform the corresponding
Http://baike.baidu.com/subview/849/15831672.htmHttp://en.wikipedia.org/wiki/Shell_ (computing)Common commandsCat file name output file content to basic output (screen or add >filename to another file) CB format source code chmod//change mode, change
Issue: After executing the "su– username" in the shell script, the script terminates execution and switches to the interactive interface behavior of the specified user name in su: I execute a script in root, but some of these commands or scripts
--from "Brother Bird's Linux private dish"--summarize and make it convenient for inspectionaccess to variables : EchoEcho $variableEcho $PATHEcho ${path}Configuration rules for variables1. Variables and variable contents are linked by an equal sign "
Recently encountered in the project batch conversion JMeter test Results JTL problem, complete a script, recorded as follows:#bin/SHfilelist=`lsJTL ' # reads and stores all file lists of the JTL directory into variables for file inch$filelist
Cat stands for concatenate.Case 1.When the text files has more blank lines, we want to remove them.We can use Regex \s+ ' \ n '.Cat File.txt | TR \s ' \ n 'Cat-t file.txt # Show Tabs as ^.Cat-n file.txt # Show line numbers. Specifies current
1, shell script generally to #! Beginning.2, printf:printf "%-5s%-10s%-4s\n" No Name Mark. %-5s indicates a string substitution with a left-aligned format of 5 (-left-aligned) and, if not used-to specify alignment, the string is aligned to the right.
Writing a very simple script, the results are very strange.1 #!/bin/bash 2 3 path= $HOME/vlc_transplant4 4 5rm -F $PATH/ VLC6Ln -S $PATH/bin/vlc-static $PATH /vlcExecution Result:[Email protected]:~/vlc_transplant4$./update. SH . /update. SH 5
for $! and $? This type of context-dependent variable, when it is pushed to the remote host as part of the command line, be sure to consider its particularity, otherwise the script will be difficult to execute in the way you expect, and the
Syntax for the Read command command:Read [parameter] variable name commonly used parameters are as follows:-t timeout to set the time-out.-P Prompt Sets the prompt message, which will appear before the cursor.Condition test:The condition test can
Linux-shell test, linux-shell
Nature of testing:
Is an operation command
According to $? Return Value to determine whether the condition is true
Operation Specifications:
Format 1: test Condition expression
Format 2: [conditional
Shell Step by Step (2) -- Variable, stepvariable3. Variable declaration readonly read-only export modification or printing environment variable export-p display current environment[Note] Note that there must be no spaces before and after the
Java beauty [from cainiao to expert drills] using shell scripts in Linux (1), javashellAuthor: erqing
Personal site: zhangerqing.cn mail: xtfggef@gmail.com Weibo: http://weibo.com/xtfggef
Shell scripts combine multiple commands and write them
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