Condition test1. Test condition tests or [] (test conditions are true false)
Example: string comparison#!/bin/bashRead dataTest "$data" = = "Hello" //note there are spaces on either side of the equal sign or [$data = = "Hello"] echo $?
Recently do the computer room bandwidth detection. Recently wrote a shell script to ping the IP of the machine room in bulk, returning the failure rate and the average response time#!/bin/bashlog=$1.logecho-n "" > $logfor i in ' Cat $ do/bin/ping-s 1
The difference between one, ' and $ ()The anti-quote itself escapes the \, retains its own meaning, and if we want to play a special meaning in the anti-quote, we must use 2 \ to represent it. in inverted quotation marks: \ \ = \$ () in: \ = \Note:
The difference between 1, ' and $ ()The anti-quote itself escapes the \, retains its own meaning, and if we want to play a special meaning in the anti-quote, we have to use 2 \ to represent it. So we can simply imagine the inverted quote: \ \ = \$ ()
1. View HelpHadoop fs-help 2. UploadPaths on files > such as: Hadoop fs-put test.log/3. View the contents of the filePaths on Hadoop fs-cat such as: Hadoop fs-cat/test.log4. View File listHadoop Fs-ls/5. Download the filePaths on Hadoop fs-get 6,
What is a shell script?Shell script is similar to batch processing under Windows/dos, that is, the use of various commands pre-placed into a file, convenient one-time execution of a program file, mainly for the convenience of administrator settings
1.Tenth LineHow would you print just the 10th line of a file?For example, assume this file.txt has the following content:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10Your script should output the tenth line, which is:Line 10----------
VariableDefining variablesYour_name= "Runoob.com" #变量名和等号之间不能有空格Using variablesYour_name= "QINJX"Echo $your _nameEcho ${your_name}echo "I am good at ${skill}script"echo "I am good at ${skillscript}"Curly braces are added to help the interpreter
The basic meaning of shell variable $#,[email protected],$0,$1,$2 in Linux:Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a
Common options for Uniq commandsRemove Duplicate rows-U display non-repeating rows-D shows duplicate rows-C Print the number of repetitions per lineThe test text content is as follows:# Cat 4.txt11111122222222333333334444(1) Uniq# Cat 4.txt | Uniq
1.shell Script InterpreterBourme Shell (/usr/bin/sh or/bin//bin//usr/bin//usr/bin/ for Root (/sbin /SH)Bash is widely used in the development environment because it is easy to use and free2. First shell script#!/bin/"Hello World"#! is a contract tag
Cut command common optionsThe test text content is as follows:# cat Name1.txt name1 alvin1name2 alvin2name3 alvin3name4 alvin4# cat 2.txt name1:100name2:101name3:102(1)-CCut the 1th character of each column# Cat Name1.txt | Cut-c1NNNNCut the 1th, 3-4
The test text content is as follows:# cat Name1.txt name1 alvin1name2 alvin2name3 alvin3name4 alvin4# cat name2.txt name1 100name2 101name3 102CCCCCCCCCCCCCCC C(1) Paste merge each line of two files by one by one# paste Name1.txt name2.txtname1
Reference: http://blog.csdn.net/wanglang3081/article/details/49423105 (1) Makefile is essentially a shell script, that is, each command is a shell process, and the shell process exits when it finishes running. (2) Shell code line, if there is =,
Performance testing, you may change the environment to change, each time the test, the configuration file is different, may cause the test to fail.Suppose there is a correct configuration file for Zoo.cfg.template, and the configuration file for the
Topic linksDp[n] = Sigma (A[i]*dp[n-i]), given a1.....an, Dp[n]. N is 1e5.The form of this equation is obviously a convolution, so you can use the FFT to optimize it, but this will also time out. So you can use the CDQ to optimize the partition.CDQ
First, several commands are elaborated.Echo $ shows the currently used shell versionDpkg-reconfigure Setting the package typeThe reason why the newspaper is wrong:The default shell parsing used by Ubuntu is a feature that Dash,dash only part of
The call file system (FS) shell command should use the form $HADOOP _home/bin/hadoop FS.All FS shell commands use the URI path as the parameter.The URI format is Scheme://authority/path.The scheme for Hdfs,hdfs is HDFs, such as Hdfs://localhost:9000/
First, define variablesDefine variable names without a $ (unlike PHP, as with Python), with no spaces between variable names and "=" (special, unlike other languages)Example: x= "Hello World"Note: The naming of variable names should follow the
Shell scripts are extremely important in operations, and the use of arrays in shell scripts is a very useful aspect in both looping and computing.Here are some operations on the array aspects of the shell script to record here, hoping to help
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