Using the shell to automatically back up the database

#!/bin/sh#mysql Address # Detects if the user entered the password manually mysql_host= "" #mysql用户mysql_user = "" #mysql密码mysql_password = "#mysql数据库名 # If you do not fill in the database name you want to export the error message and terminate

Description of the Shell's conditional expressions

Determine if b.txt This file exists, there is output 1, there is no output 0[-F B.txt]&& echo 1| | Echo 0-F: Determines whether the file is-E: Determine if the file exists-D: Determine if the directory-R: Judging whether it is readable-W: Determine

Shell Script application (if statement's structure)

1, test: the detection of the expression is established, the return value is 0, otherwise, not 0Method:1) test expression2) "Expression"2. File test:-D: Whether it is a directory-F: Whether it is a file-E: whether there is-r: Whether Read permission

Conditional testing and comparison of shell scripts

Conditional test Syntax:Syntax 1:test This is the method of conditional test expressions with the test command.Syntax 2:[]: This is the way to test an expression with a single parenthesis, as with the use of the test command, the recommendedSyntax 3

NOTES: Linux--First knowledge shell

One: Word accumulationCurrent: currentlyDirectory: Directories Entries: ArticlesDefault: DefaultsInformation: InformationFormat: FormattingIgnore: NeglectLicensing: LicensingTwo:1.GNU Bash Description: The shell is the user interface of the Linux

Using the shell to read a text file sent to Kafka

#!/bin/SH# # parameter definition dt=`Date+"%y%m%d"-D"-1 days"' Outpath=/xxxx_log_${dt}.txt brokerlist=192.168.1.:9092,192.168.1.101:9092,192.168.1.102:9092Echo$dt $outpath $brokerlist # # Query hive table, output file to the specified path

In-Shell date operations

1. date-d operationDate +"%y%m%d" -D "+ndays" #今天的后n天日期 Date +"%y%m%d" -D "-ndays" #今天的前n天日期2. Common Date format outputDate+"%F"#输出: -- .- ,Date+"%d"#输出: ./ ,/ ADate+"%y%m%d%h:%m:%s"#输出:20120608 Geneva: the: -Date+"%y%m%d"#输出:2

8.6 Pipe character and job control 8.7/8.8 shell variable 8.9 environment variable configuration file

Five week fourth session8.6 Pipe symbol and job control8.7/8.8 Shell variables8.9 environment variable configuration file8.6 Pipe symbol and job controlPipeline compliance with Job controlTasks to stop: jobsMove the task to the front desk: FGTask is

Shell Script--File test

A file test is a test of whether a file or directory existsTest file format [operator directory or file] Note that there is a space between the opening parenthesis and the operator, and there is a space between the file or directory and the

Shell Terminal terminfo Command tput

Tput commandtputYou can change terminal features, such as moving or changing the cursor, changing text properties, clearing specific areas of the terminal screen, and so on.Cursor PropertiesIn a shell script or command line, you can change the

Shell Script--Numerical calculation

Native bash does not support simple math operationsWhen you are beginner, you can use $ (()) and expr to implementUse $ (()) to achieve:#!/bin/bash# file name: Test.shecho $ ((1+3)) #命令行第2个参数和第3个参数求和 # At this point the + number can be added without

Shell SED Syntax detailed

SED replaces a string in a fileSed-e ' s/foo/bar/' myfile replaces the first occurrence of each line in the MyFile file foo with a string bar , and then outputs the file contents to the standard outputSed-e ' s/foo/bar/g ' myfile g allows SED to

Shell Learning Notes

number of logged-in users: who | Wc-l See which users are logged on to the system : who Create a new file /bin/ct11, enter a command in the file,chmod Set the Execute permission for the file # cat >/bin/ct11W.H.O. | Wc-lPress Ctrl+d# Cd/

Writing shell Scripts--judging the user's parameters

Test statement format: [conditional expression]A few common forms:[-D/ETC] to determine if/etc is a directory type,[-e/etc/php.ini] Determine if the/etc/php.ini file exists[-f/etc/php.ini] Judge/etc/php.ini is not a general

Linux Getting Started--shell script Common information summary

$ default variable in 1.shell    $n $ $ for the first argument, and $ for the second argument ... $# Number of command-line arguments the name of the current program               $? The return code of the previous command or

Shell Process Control

Shell Process ControlUnlike Java, PHP and other languages, SH's process control is not empty, such as (the following is the PHP Process Control notation):PHP if (Isset ($_get["q"]) { search (q);} Else { // don't do anything }You can't write

The difference between $ (()) in the shell and $ () and ${}

$ () and ' (anti-quote)In the bash shell, $ () and "(anti-quote) are used for command substitution.$ echo the last Sunday was $ (date-d "last Sunday" +%y-%m-%d)Get the date of the previous SundayThe reason for using $ () ' (anti-quotes) is

Brother even Enterprise shell pen question 16-31

Enterprise Practice Question 16:Enterprise Case: Write Network Service standalone process mode rsync system startup scriptFor example:/etc/init.d/rsyncd{start|stop|restart}.Requirements:1. To use the System function library technique.2. To use a

Shell after class summary

Shell after class summary High wavesArchive: Learning NotesDecember 4, 2017 13:31:08 Shortcut keys:Ctrl + 1 title 1Ctrl + 2 title 2Ctrl + 3 title 3Ctrl + 4 ExampleCtrl + 5 Program CodeCtrl + 6 Body Format

Introduction to Shell Array usage

Introduction to ArraysBash provides only one-dimensional arrays, and does not qualify the size of the array. Similar to the C language, the subscript of an array element is numbered starting with 0. Gets the elements in the array to take advantage

Total Pages: 541 1 .... 341 342 343 344 345 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.