#!/bin/SH# DatabaseInfoDb_user="batsing"Db_pass="BATSINGPW"Db_host="localhost"db_name="Timepusher"# Others Varsbin_dir="/usr/bin"#the MySQL bin Pathbck_dir="/mnt/mysqlbackup"#the Backupfiledirectorydate=`Date+%F ' #
I. SOURCES of grepTo find a string by using the EX Editor::/pattern/pwhere P is printed, the first line containing the string pattern is printed, if you need to print all lines that contain pattern, you can::/g/pattern/pWhen G appears in front of
There are two ways of doing this:1, with TRExample: uppercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE lowercase to uppercase)lowercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE uppercase to lowercase)2, with
1, write script/root/bin/systeminfo.sh, display the current host system information, including host name, IPV4 address, operating system version, kernel version, CPU model, memory size, hard disk size.#!/bin/bash# author:huiping# version:1.0.1# date:
Brief description of single quotes, double quotes, and unquoted
Name
Explain
Single quotation marks
What you see is what you get: Everything inside a single quote is output as it is, or what you see in single
ObjectiveWhat the hell is a shell? Before this, we should understand the issue of file permissionsBody
Shell versionVarious versions:
Bourne Shell (SH), C Shell (CSH), and Korn Shell (Ksh)And at present:The common and CentOS default
Awk is a powerful text analysis tool, with the search for grep and the editing of SED, which is especially powerful when it comes to analyzing data and generating reports. To put it simply, awk reads the file line-by-row, using spaces as the default
${varname:-word}If varname exists and is not nil, returns the value of VarName, otherwise returns word. This is commonly used to return a default value when VarName is undefined${varname:=word}If varname exists and is not nil, return the value of
1. After installing Spark, enter spark in the bin directory: Bin/spark-shell scala> val textfile = Sc.textfile ("/users/admin/spark/ Spark-1.6.1-bin-hadoop2.6/readme.md ") scala> Textfile.flatmap (_.split (" ")). Filter (!_.isempty). Map ((_,1)).
For syntax formatfor Var in list;doCommandsDoneWhere list can contain:1) write directly for in a b c D; do Echo $alpha Done2) variableslist="a b c d" for in $list; do Echo $alpha DoneThe variable is replaced when the shell executes, and
ExplainRedirect: Is an action, an Operation action actionFile descriptors: Nouns, another representation of a file, Linux everything is file."Base redirection form"
Input redirect
Usage Rating: * *
Glob extensionIn the path extension in the shell, there are several glob involved:? Match any single character* Match 0 to more characters[Set] matches any one of the characters in the set, such as [0-9], matches any number[!set] matches any
1. What is a regular expressionIt is mainly used for string pattern segmentation, matching, finding and replacing operations.2. Regular expressions and wildcard charactersA regular expression is used to match a qualifying string in a file, and the
Before I wanted to print out the code, it seemed that, after merging, I found that there were more than 2000 pages in Word and then dropped the ~anyway, which was very useful.For example I have text A001.dat, A002.dat, A003.dat ... and then want to
Expr can do the following:Logical operationsArg1 | Arg2 logic or operation, true return arg1, otherwise return arg2 (null or to determine the true and false parameters, there is a short-circuit function)Arg1 & arg2 Logic and operation, true return
The value of the variable in the shell, if you do not specify the type manually, the default is the string type:For example:A=123b=456C= $a +#becho $cThe result is output: 123+456In the shell, if you want to perform numeric operations, you can do
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