Shell Backup Database

/bin/bashBakpath=/opt/mysqlMyuser=rootmypasswd=123456Socket=/data/3308/mysql.sockmycmd= "Mysql-u$myuser-p$mypasswd-s $SOCKET"Mysqldump=mysqldump-u$myuser-p$mypasswd-s $SOCKET-X-f-r[!-D $BAKPATH] && mkdir-p $BAKPATHDblist= ' $MYCMD-e "show databases;

Shell exercises (1)

(1) Please follow the date format (XXXX-XX-XX) to generate a daily file, such as the file generated today is 2017-07-05.log, and the use of the disk to write to this file, (do not consider Cron, just write the script can be)!#! /bin/bashd= ' Date

A production shell script

#!/bin/bash#created: 2017.07.21#author: molewan#description: help erp app  upgrade ########################################################## #脚本说明 ################################## ######################### #a, copy the data that needs to be added

Linux shell renders data

Input/Output Display on the monitorRedirect to FileStandard file descriptor0 STDIN Standard Input1 STDOUT Standard output2 STDERR standard error redirect error message when you need to develop a file descriptor Ls-al badfile 2> test11111Ls-al

Positional variables and special variables in the shell

$$the PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?end code of the last Run command (return value)$-flag at a glance using the SET command$*all parameter lists. such as "$*" in the Case of "" ", in the

Shell Scripting Encryption

Think of a long time not updated blog, today in the group to see the discussion about shell script encryption things.Think about it too, we are writing scripts sometimes configure the relevant account and password things, so as long as the

Linux Shell simple script to modify IP

Tag: Shell Modify IP #!/bin/bash#2017-7-13#by ip_file=/etc/sysconfig/network-scripts/ifcfg-eth0zt= ' grep  "static"   $IP _file|wc -l ' bf_file=/data/ifcfg-eth/' date  "+%y_%m_%d" '/ipaddr= "192.168.25.107" netmask= "255.255.255.0 "Getaway=" 192.168

Linux-shell Programming (I.)

Shell Programming Script ProgrammingCompilers, interpretersProgramming languages: Machine language, assembly language, advanced languagesStatic language: Compiled languageStrongly typed (variable)Convert into executable format in advanceC, C + +,

Linux users modify the user shell

To deny a system user login, you can set its shell to/usr/sbin/nologin or/bin/false# usermod-s/usr/sbin/nologin usernameOr# usermod-s/bin/false username/bin/false/bin/false does nothing but returns an error state and exits immediately. Set the

"Shell" gets the first + position parameter

Reprinted from: http://www.cnblogs.com/sheldonxu/archive/2012/06/25/2560770.htmlIn a shell script, you can get the nth parameter in a $n way, for example, a script named Paramtest:#!/bin/bashecho $The result of executing./paramtest a B is to print

Shell command getopts Usage

Write shell scripts Common sh test.shThe notation of-M 2-d 3Case script:#!/bin/bashwhile getopts ": a:b:c:" Arg #选项后面的冒号表示该选项需要参数doecho "arg": $arg case $arg in a) echo "a ' s ARG: $OPTARG---$OPTIND "#参数存在 $OPTARG

Some shell query statements for HBase

Huawei bids (do not want to spit) a variety of reasons can only use HBase shell query, in this record of their own exploration of the hbase shell to avoid the next time you have to findScan ' ogg_sel_ioc_sv_product_name_info ',{filter=>

Shell script Programming

BASH: Weakly typed languageVariable type:Environment variables, local variables (local variables), positional variables, special variables1. Local variables: Only valid in the current process, parent-child shell is not universalDeclarative method:

Shell script Instance-Bulk Add user name password

#!/bin/bashread-t 30-p "input name:" Nameread-t 30-p "input number:" num #输入要批量添加的用户数量并将变量赋给numread-t 30-p "input PA ssWOrd: "passif[-N" $name "-a-n" $num "-a-n" $pass "] #判断都不为空theny =$ (echo $num | Sed ' s/^[0-9]//g ') #如果 $num contains 0-9, then

Shell Script Collection

#本人新手写的不好之处, be sure to advise me. I will update this content on an irregular basis.1. Enter the IP address to find the domain name specified in the/etc/hosts file#!/bin/sh#author VPERSON#QQ 737304790#enter The specified IP to find the corresponding

Getting started with a simple SHELL under MAC

1. create file. sh fileIn this example, the full name of the sh file is demo.sh, and the next step is to use the freely familiar editor editor command to2. Write the. sh

The shell enters the required user name or password through EOF in the script

The landlord encountered a scene like this:Execute a script locally, log on to the server, but the login server requires a password to implement the password manually in the scriptThe function of EOF can be achieved by:ssh [Email protected] 192.168.

Shell script-Simple Add user

Description: Adds a user name and password through a script, and discards the add if the user name already existsScript Name: test2.txtCd/optlsmkdir SHELLLSCD SHELLLSVI Test2.txtThe script reads as follows:#!/bin/bashid $ &>/dev/null && echo "User $

Data structure and algorithm--advanced sort: Shell sort and quick sort "to be Continued"

Advanced sorting is much faster than simple sorting, the time complexity of simple sorting is O (n^2), and Hill (shell) sorts O (n (logn) ^2), and quick Sort is O (N*logn).Note: The following is an example of a small to large sort of an int

Shell scripting language Usage

Shell program run:1./xx.sh. Running the shell this way requires the shell program to have executable permissions. chmod a+x xx.sh to add executable permissions.2, Source xx.sh.3. Bash Xx.sh,bash is a script interpreter, which is essentially an

Total Pages: 541 1 .... 520 521 522 523 524 .... 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.