Meet
Meaning
&&
Command1 && command2: Command 1 returns True (Command return value $ = = 0), command 2 can be executed. Can be used for if judgment.CP 1.txt.. /&& echo "succes" #-->successCP 1.txt.. /&& rm-f. /1.txt && echo
Occurs when a service command is executedShell-init:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or directoryChdir:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or
First, conditional statements
Simple conditionsif Then # When the condition is established, the content is executed;fi If the reverse is written, the meaning offiif
Complex conditionsif Then # When condition is established, execute
139 e-mail message will be sent automatically after the email, using this function can send the server's exception information to 139 boxes and then the phone will receive SMS reminders, to facilitate the management of the server function.To avoid
Zhanhailiang Date: 2014-10-181. Load the configuration file sequence during the Linux login process:/ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]You can view the default ~/.BASHRC file as
There are three main forms of processing Linux input in shell scripts:1) Treat them like command line arguments, and obtain corresponding input parameters by corresponding positional parameters2) through getopt and getopts These two commands 3)
Tag: Shell Before answering the questions in this chapter, let's first understand the concept of return value!Each Command or function we run in shell will return a value of the parent itinerary at the end,Return Value.Available in shell command
Category:
You can execute another shell script (or non-executable file, mainly used to obtain the value of some variables) in one shell script :. file name (including path) or variable = file name (including path ). $ variable Note: there is a
1. Use grep (the result is enclosed in parentheses. I wonder if I can match the content in the brackets only)
$ A = 'abc [EDG] adfirpqu '$ echo $ A | grep-O '\[. * \] '# escape [EDG] $ B = 'abc (EDG) adfirpqu' $ echo $ B | grep-O '(. *) '(EDG)
2.
Tag: String null
Integer comparison:
-EQ equals to, for example, if ["$ A"-EQ "$ B"]
-Ne is not equal to, for example, if ["$ A"-ne "$ B"]
-GT is greater than, for example, if ["$ A"-GT "$ B"]
-Ge is greater than or equal to, for example, if ["$
1. Specify the script interpreter at the beginning
#! /Bin/sh or #! /Bin/bash
2. Provide the function description, author, version, and other information at the beginning
# Description: # Author: # contact: # Last edited: # version:
Note: you
Shell operation command:
HDFS path, defined in core-site.xml
fs. Default. Name
HDFS: // master. hadoop: 9000 master. hadoop namenode Host Name
Use/to replace the current absolute path
Hadoop FS-ls/View content in the root directory of
1. Five methods for calculating the value:
(I ++ ))
Let I ++
I = $ (expr $ I + 1)
I = $ (echo $ I + 1 | BC)
I =$ (echo $ I 1 | awk '{printf $1 + $2 }')
2. The time command is used to
1. The length of the string, for example:
* $ Var = "Get the length of me"
$ Echo $ {# var}
20
* $ Expr length "$ Var" # note that double quotation marks are used.
20
* $ Echo $ var | awk
Use shell scripts to analyze Nic status information
Question:
Shell programming1. Write a script to read the traffic on the NIC, the number of packets received and sent, the number of packet loss, and the packet loss rate;2. The NIC name must be
--- Content from http://www.jb51.net/article/31232.htm
By default, values assignment and operations in shell are processed by strings,1. Example of an error methodA)Var = 1 + 1Echo $ VaRThe output result is 1 + 1. Tragedy.B)Var = 1Var = $ var +
What is the difference between $ @ and $ * in shell learning?
Before talking about $ @ and $ *, you must start with the positional parameter of shell script...We all know how variables are defined and replaced.However, we also need to know that
[Shell] example of if, for, while flow statement and integer string comparison
Preface:
In fact, Shell is a command interpreter that explains the commands entered by the user and sends them to the kernel. In addition, Shell has its own programming
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