Shell script to back up the database

#!/bin/bash#back_mysql by 2016-11-14bak_dir=/data/backup_db/' Date +%y%m%d 'Mysqldb=mysqlmysqluser=*****mysqlpw=******If [$UID-ne 0];thenecho "must to being use as root for exec shell"ExitFi#判断是否存在文件, \033[32m is the color of the displayif [!-D $bak

The use of parentheses inside the shell

Middle BracketBrackets are divided into single brackets [], and double brackets [[]], and brackets are commonly used in expression judgments, and parentheses can also be used in expressions, as mentioned later.Single brackets []a=5b=3[$A-eq $B]

Shell timed Tasks

1. Know CronCron is a timed execution tool under Linux that can run a job without human intervention. Since Cron is a built-in service for Linux, it does not automatically get up, and you can start and shut down this service in the following

Shell script, insert "|" between every 5 characters, do not insert "|" At the end of the line.

TextAaaaabbbbbcccccddddeeeeefffffkkkkkvvvvnnnnngggggThe following results are expected:aaaaa|bbbbb|ccccc| ddddeeeee|fffff|kkkkk| VVVVNNNNN|GGGGGMatch requirements: You want to insert a "|" between every 5 characters, and if the number of characters

How the shell passes external parameters to the file

How to pass parameters inside the shell:JS Code SH test.sh Zhang 20 How do you accept parameters in the test.sh?JS Code #!/usr/bin/env SH Name=$1 Age=$2 echo "name is ${name} & ${age}" Output: Name is Yaochun &

Shell script commands

######################## # # #6. Shell script Command # # ######################### # # #1. diff####diff file File1 # # compare two different files 650) this.width=650; "Src="

Case and function of shell programming

I. Overview of CASE statementsUse case statements to rewrite if multiple branches to make the script structure clearer and more hierarchicalPerform different command sequences for different values of variablesThe case statement is structured as

Shell Programming Learning 2--Command Daquan

There are a number of commands in Linux that can be divided into 10 categories (see [1]): 1) file management; 2) document editing; 3) file transfer; 4) Disk Management; 5) disk maintenance; 6) network communication; 7) system management; 8) system

Shell script, logical structure problem exercises.

awk '/5/{a=1}!a ' file2Results:1234Explain:The first line/5/does not match skip {a=1}, continue to!a, at which point a no value belongs to the false take reverse to true, so the first line of outputThe second line/5/does not match skip {a=1},

Input and output in the shell (Bash Shell 03)

Input and output in the shellStandard input: KeyboardStandard output: Terminal displayThe >> append is a newline appendEcho- n do not trailing line breaks-e enable escape function to interpret backslashes-e disables the escape function that

SWT Shell Setup window in the middle of the screen

/*** Setup window is located in the middle of screen* @param the Shell to adjust the position of the Window object*/public static void Center (shell shell){Get screen height and widthint screenh = Toolkit.getdefaulttoolkit (). Getscreensize ().

Shell Note 5

Filter GawkGawk is a language that can perform pattern scanning and data processing. Gawk searches for one or more files, finds records (usually rows) that match the pattern, and processes the records by performing the specified actions. Gawk

Shell Note 1

The shell is the shell of the operating system, a command interface for users to use the operating system, and a bridge between the user and the operating system kernel. Shell is commonly known as shell. Refers to the software that provides the

A useful shell script

#!/bin/Bash#if[$1-eq NULL]; Then# Echo "Please input params1!"# exit#fi#if[$2-eq NULL]; Then# Echo "Please input params2!"# exit#fi# type, $1{SCP,SSH}, SRC $2, DST $3User=Hadoopif[" $"!=""-A" $"!="SCP"] ; ThenUser=$3fiif["$4"!=""] ; ThenIPList=$4

Shell script, how awk handles two rows in a file that are associated with the upper and lower lines.

File D.txt The following contentGGG 1portals:192.168.5.41:3260Werew 2portals:192.168.5.43:3260How to change the file D.txt content to the following contentGGG 192.168.5.41:3260Werew 192.168.5.43:3260Problem Solving Ideas:[[email protected] study]#

The difference between ', ', ' and ' in the Linux shell

Learn a bash script today and see that there is a: bin= ' dirname '(dirname filename is the directory where the file is exported, and $ is the file name of the bash file, which is generally used in bash to enter the directory where the script is

Shell Small Problem Summary

Writing a script today meets a strange thing.Variable A is definedIf [-a $a];then echo "exists"; else echo "not exists"; fiResult output:ExistsIt's a blind moment, but it's going to change.If [-a "$a"]Of course, a here is a script input parameters,

Common Shell Instances

1. Exclude portions of files from disk usage statisticsDu--exclude "*.iso" dir2. Find the maximum of 10 files in a specified directoryFind-type f-exec du-k {} \ |sort-nrk 1 |head-n 103. List the maximum 10 commands for the current systemCat.

Shell Syntax One

See the Shell function notation for reference/etc/init.d/functions printing information can be called, action functionLocal variable use plus local definitionGlobal variables don't add anythingNeed to execute the life using the anti-quote 'Strings

Java invokes shell commands and scripts dedicated to Hadoop/spark clusters

ObjectiveNote that this blog post is based on the following blog posts, based on them, dedicated to my big data

Total Pages: 541 1 .... 498 499 500 501 502 .... 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.