Shell script Backup Database (docu)

bz2

#!/bin/bashPath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinExport PATH#数据库用户名Dbuser= ' Root '#数据库用密码dbpasswd= ' Password '#需要备份的数据库, multiple databases are separated by spacesDbname= (' dbname1 ' dbname2 ' dbname3 ' dbname4 ' dbname5

Shell Exercises-judging functions

Use the conditional function if to compose a shell function called F_judge, which implements the following functions1) when the/home/log directory exists, move the files or directories that start with all TMP in the/home directory to the/home/log

[Shell programming] automatically deletes operating system users

Linux often need to delete user actions, manual operation to perform Userdel operation can, if the deletion fails according to the error prompt action. But what if the script needs to invoke the Delete user action? Use the following example to

Introduction to Shell Process statement usage

1) Use if, case, readExample 1:#!/bin/bash#读取终端输入的字符Read-p "Please input a number:" NN1= ' echo $n |sed ' s/[0-9]//g '#使用if语句进行判断if [!-Z $n 1]Thenecho "Please input a number."Exit 1elif [$n-lt 0] | | [$n-GT 100]Thenecho "The number Ranger is

Shell programming Syntax (i)

Steps to create a shell program:First step: Create a script file. Sh.Second step: Grant permissions so that it can execute chmod u+x. shStep three: Execute./example or SH exampleShell structure:1. #! Specifies the shell that executes the script2.

Linux Shell Learning Four

Shell Branch Statement Case inch mode 1) Command1 command2 command3 ; Mode 2) Command1 command2 command3 ;; *) Command1 command2 command3 ;; EsacDescription: After the case is taken, the value is the keyword in,

Shell parameter processing templates

Save a copy of the template, then use it for simple parameter processing#!/bin/Bash whilegetopts h:ms option #选项后面的冒号表示该选项需要参数 Do Case "$option" inchh)Echo "option:h, Value $OPTARG"#参数存在 the $optargEcho "Next arg index: $OPTIND";; m)Echo "option:

Functions in the shell

What is a function? 1) Basic concept of function functions:function, refers to the code of a separate function as a whole and take a name for it, that is, named code snippet, also known as function; function is an important component of

Numerical conversion in the shell

Octal (020) →10[[email protected] yemo]# echo $ ((num=020)) 16[[email protected] yemo]# echo $ ((num=8#20)) 16Hex (0xff) →10[[email protected] yemo]# echo $ ((NUM=0XFF)) 255[[email protected] yemo]# echo $ ((NUM=16#FF)) 255[[email protected] yemo]#

K8s Images Shell

k8s

#!/bin/bashkube_version=v1.7.2kube_pause_version=3.0etcd_version=3.0.17dns_version=1.14.4Images=

Shell definition variable Pits

Debugdir="/debugexamples "Releasedir="/releaseexamples "Docdir="../../../Mew_devdata/Interfacedoc/" forPathinch' ls ' doifTest-d $path ThenEcho'Test Package'$path cd $path./test.sh CD. RM-r $docDir $path$debugdir RM-R $docDir $path$releasedir CP-r

Whether the shell monitoring process exists

1. Direct to the code: I am this is two programs. Most likely to write a function[email protected] src]# cat checkprocess.sh#!/bin/bashCheckprocess (){Ps-ef|grep $1|grep-v grepIf [$?! = 0];thenSystemctl Start $Elseecho "It ' s

Linux entry fourth day--shell basics

First, shell overview  1. Overviewcommand-line interpreter   (shell, which is our operating interface), the computer only knows 0101 binary, we need to use the ASCII table to translate  The more official explanation is:The shell is a program

Linux Shell determines whether files and folders exist

#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X ' $myPath]; then mkdir "$myPath" fi #这里的-D parameter to determine if

Name of the shell-3-file

1. Generate files of any sizeif=/dev/zero of=junk.data bs=1m count=1recorded 1+0 read- inrecorded the writing of 1+0.1048576 bytes (1.0 MB) copied,0.00219263 sec,478 MB / secIf represents the input file, The of is the output file,the BS size,

Shell Match single quotation mark

Https://stackoverflow.com/questions/91110/how-to-match-a-single-quote-in-sedToday is looking at an example of sed '/larry\ 's ' Larry. The results are not matched. Google is not aware of the query. Matching single quotation marks cannot be simply

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

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 programming for Linux Select and case usage

Select usage in the shell:Grammar:#i/bin/bashselect variable in list do you want to execute statement doneExample:#!/bin/bashecho "What is your favourite OS?" Select Var in "Windows" "Linux" "Gnu Hurd" "Free BSD" "Other";d O-echo "You had selected

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

Total Pages: 541 1 .... 492 493 494 495 496 .... 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.