Execute MySQL statements in Shell scripts
For automated O & M, such as backup and recovery, DBA often needs to encapsulate SQL statements into shell scripts. This article describes several methods for calling SQL statements in a MySQL database in a
For automated O & M, such as backup and recovery, DBA often needs to encapsulate SQL statements into shell scripts. This article describes the shell script in the MySQL database in Linux.
For automated O & M, such as backup and recovery, DBA often
Article title: automatically set different local codes under Shell and X. Linux is a technology channel of the IT lab in China. It includes desktop applications, Linux system management, kernel research, embedded systems, open source, and other
[[Email protected] shell] # Cat shift. Sh #! /Bin/bash Until [$ #-EQ 0]; do Echo "the first is: $1 total is $ #" Shift Done [[Email protected] shell] #./shift. Sh 1 2 3 4 5 6 The first is: 1 total is 6 The first is: 2 total is 5 The first
I am used to the C/C ++ programming environment, and then switched to shell programming, there is always a strange feeling.
The general if-then-else Function Format in shell is as follows:
If condition 1
Then command 1
Elif condition 2
The subscript of the array in shell starts from 0 by default.
1. Put the string in an array to obtain its length.
#! /Bin/bashStr = "a B -- n d"Array = ($ str)Length =$ {# array [@]}Echo $ length
For (I = 0; I DoEcho $ {array [$ I]}Done
Execution
Some related regular expressions and some temporary files are often used in shell scripts written in Python.) There are also some related files such as the/etc/passwd file, the following is an introduction to the relevant files we will use in the
The case syntax in shell is as follows:Case word in pattern1) Statement (s) to be execute if pattern1 matchs; pattern2) Statement (s) to be execute if pattern2 matchs; pattern3) Statement (s) to be execute if pattern3 matchs; *) Default action ;;
In shell scripts, the $ default variable contains some internal variables, which are a special type of variables provided by Linux. These variables are used to make judgments in programs. In a shell program, the values of such variables cannot be
Modify the color in shell in LinuxEcho-e "\ 033 [32; 49; 1 m [DONE] \ 033 [39; 49; 0 m" output result: [DONE] ########################## the color of a text terminal can use "ANSI unconventional characters sequence. Example: echo-e "\ 033 [44; 37; 5
In shell scripts $, $ #, $? $0 the execution name of this program $ n the nth parameter value of this program, n = 1 .. 9 $ * all parameters of this program, this option parameter can exceed 9. $ # Number of parameters of the program $ PID of the
Use colons in shell with equal signs, plus signs, and minus signsIn question 13, there were cases of colons and equal signs mentioned, with colons, as long as they are null (undefined, null) can be overwritten;If no colon exists, it can be
Usage of $ {} in shell 1. truncation function $ {file # */}: remove the first/and its left string: dir1/dir2/dir3/my.file.txt $ {file ##*/}: remove the last/and its left string: my.file.txt $ {file #*.}: remove the first one. and the string on the
Reprint please indicate: http://www.cnblogs.com/winifred-tang94/If conditional statement syntax:If [conditional expression]ThenCodeElseCodeFiNote : In the IF condition statement above, there should be a space between if and [, and the conditional
the difference between the ' and $ ' ():In Bash, $ () and "(anti-quote) are used for command substitution.Command substitution is similar to variable substitution, which is used to reorganize the command line, complete the command line in quotation
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.