Backing up the database regularly through the shell

Demand: Daily 2:10 back up the database zhengdb to/data/backup/db. The start and end of the backup can give the appropriate information. The backup file identity standard is the backup time as the file name, and packaged into a. tar.

Shell programming string comparisons and for loops

One, string comparison 字符串比较使用:= ,==,!=,\>,\ , \ ‘aa‘ 字符串是否为空判断: 如:- n string 判断字符串string是否为空,不为空返回真,-z string 判断字符串是否为空,为空返回真。Second, for Loop用法: for 变量名 in 列表 do 循环体 doneIii. Scripting Exercises1.

Linux_ (4) Shell programming (bottom)

Five, Shell Process Control1. A heavy BranchIf statement syntax format:If conditionThenCommand1FiThe FI at the end is the if inverted.Write a line:if condition; Then Command1; Fi2. Two branchesIf ELSE syntax format:If

Remote disk partitioning with shell scripts

Learning about Linux, some time ago to learn the shell script, wrote a very simple script, remote other virtual machine to partition the disk, their own pure hand, but also a record of individual learning process, the great God can skip!Here is the

Shell Programming flow control (conditional statements and loop statements)

1 If ... else ...Basic Format:If conditionThenCommendElseCommendFi     Of course you can write to a line, use [] to indicate the boundary, or to indicate a branch. For example:  if [ $ (ps -ef | grep -c "SSH" ) -gt 1 ];then echo "true" ; fi   

For loop of shell scripts

There are many types of for loops in shell scripts, and a brief summary of the following is done today.1. Cyclic Digital#!/bin/bash for((i=1; i; i++)); do Echo $ (expr31); Done #!/bin/bash for i in $ (seq 1 10 ) do echo $ (expr $i

Shell intercepts the content between the specified strings

#!/bin/bash#截取字符串#path =ss/usr/share/src/root/home/adminPath=ss/usr/share/src/root/home/admin/src/addEcho $pathEcho ${path%src*} #从右向左截取第一个 the string after SRCEcho ${path}Echo ${path%/*} intercepts the first/second string from right to leftEcho

Shell Script Detection Service

Lab Environment:System: centos7-3.10.0-x86_64Testing Services: apache-tomcat-9.0.7Experimental reasons:Because the current environment for the Java test environment, so did not monitor, but recently found that the service is automatically down, and

Operators in the shell

1. Arithmetic operators2. Relational operators3. Boolean operator4. String operator5. FILE-related operatorsArithmetic operatorsThe bash shell does not provide any mechanism to perform simple arithmetic operations, but we can use some other programs,

Shell Exercise 1 Writing shell conditional sentence exercises

Instance one, compare two integer sizes#!/bin/Bash while true DoRead-P"Please input the int nums:"a BExpr$a + $b +0>/dev/NULL 2>&1 #判断是否为整数 if[$?-eq0];Then #返回值是否为0 if[$a-gt $b]; Then Echo "$a > $b"Exit0 elif[$a-lt $b];

Special variables in the shell

$: The file name of the current execution script$n: N is the natural number, the first parameter is $ A, the second argument is $, and so on$#: Number of parameters$*: All parameters, a string, for example,./a.sh 1 2 3, then $* is "1 2 3"[Email

Shell features, wildcard characters, input and output redirection, command history

One: Shell introductionThe shell is a command interpreter that provides interaction between the user and the machine, supports specific syntax, and each user can have his or her own specific shell,centos default of bash, and Zsh,ksh.Two: Command

Shell script----for loop

1. Method 1[CPP]View PlainCopy #!/bin/bash For ((i=1;i Do Echo $i Done Save As For1.shDirect SH for1.shWill error:The Syntax Error:bad for loop variable workaround code is not a mistake for standard bash, because

Shell quotes those things

#通配符 {} * []?1.1 The difference between quotation marks and unquoted 1:[[email protected] ~]# touch a B[email protected] ~]# LLTotal 0-rw-r--r--. 1 root root 0 June 16:25 a-rw-r--r--. 1 root root 0 June 16:25 b[[email protected] ~]# touch "a

Shell Basic Introduction and case

First, Shell Script Foundation1. First ScriptVim first.shThere are three ways to execute scripts, respectively:./first.sh (need to have executable permissions)SH first.sh  . first.sh(or source first.sh)2. Redirects and Pipe breaks1) redirected

Examples of Linux shell processes

#!/bin/bashRead-p "Input a dight:"Echo $REPLYDate= ' Date 'echo "DATE is ${date}"Users= ' Who |wc-l 'echo "LOGIN in User is ${users}"up= ' Date;uptime 'echo "Uptime is ${up}"#echo "HELLO world!"#echo "What's Your Name"#read person#echo "HELLO

Shell Basics (2)

Special symbols in the 1.linux shell(1) "*" represents 0 or more arbitrary symbols(2) "? "represents only one arbitrary symbol(3) "#" comment Description, "#" after the content will be ignored(4) "\" caret character, "\" After the special symbol

Disable and drop cannot be executed in hbase shell

1 Querying work status through the Web monitoring page of HBase discover the regions in transition area has a long-running task, you need to close Hbase-master and restart, and then this problem process I directly use/etc/init.d/ Hbase-master restar

The most value of the room function of the shell of garlic (good question, clever sort)

Title Link: https://nanti.jisuanke.com/t/27644Main topic:Problem Solving Ideas:Code:1#include 2 #defineLC (a) (a3 #defineRC (A) (a4 #defineMID (A, B) ((A+B) >>1)5 #defineFin (name) freopen (name, "R", stdin)6 #defineFout (name) freopen (name, "W",

Functions, arrays in 71.shell

One, the function in shell script? The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format: function F_name (){command} function

Total Pages: 541 1 .... 450 451 452 453 454 .... 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.