Common Shell (Backup database, backup site, cut access log)

Back up your Web program#!/bin/bash/bin/tar czf/mnt/backup_website/web_$ (date +%y%m%d_%h%m%s). Gz. tar /mnt/wwwroot/web/mnt/backup_websitefind . -mtime +1"*20[1-9][3-9]*"xargsrm - 0Backing Up the

Logical judgments in shell scripts

Logical judgments in shell scriptsIf logic is judged. The basic syntax for if judgment in the shell is:1) without ElseIf judgment statement; then COMMANDFIFor example:[email protected] sbin]# cat if1.sh#! /bin/bashread-p "Please input your score:

See the world from the Shell's eyes

(character) Expandeach time you enter a command, and then pressEnterkey, inBashbefore you execute your command,Bashwill be on the inputThe character completes several steps of processing. We already know two or three cases, how a simple sequence of

Some uses of Shell awk

#1, print the usage of the mounted directory, the default is separated by a spacedf-ph | awk ' {print $5,$6} '#2, separated by a space, colon, \ t, semicolonAwk-f ' [: \ t;] ' ' {print '} '#3, Print lines 3rd through 5th in the 6.txt file, nr

The implementation of Shell grammar exercises simple Read file

#!/bin/bashfile= "/etc/passwd" for row with $ (head-n $file) do echo "$row";   $row is the data for each row in the file ifs=:for value in $rowdo echo "------$value"; $value is passed through in each line: The content done;done after the split;Reads

Loop statements in the shell

For syntax formatfor Var in list;doCommandsDoneWhere list can contain:1) write directlyFor Alpha in a B C d;do echo $alphadone2) variablesList= "A b c D" for Alpha in $list;d o echo $alphadoneThe variable is replaced when the shell executes,

Shell Learning Notes (i)

1, the first line must be #! /bin/bash#! indicates that the script uses the following interpreter to interpret the execution2. Echo Print outputFor example echo "Hello World" > Aa.txt  3. Receiving parameters#!/bin/bashName=$1Age=$2Sex=$3echo "Name:

Linux Shell Usage Notes

1. BackgroundThe Linux shell is a basic skill, because the weird syntax, combined with poor readability, is often replaced by scripts such as Python.Since it is the basic skills, it needs to be mastered. After all, the process of learning shell

Write your own shell command of LS

The C language implementation of the LS command under Linux (supports-R-parameters):#include #include #include #include #include #include #include void Do_ls (char *), void Do_stat (char *,char *); void Show_ File_info (char *,struct stat

The most basic syntax for bash shell

1 Basic composition of shell statementsThe shell is separated by a space between each basic constituent element.For example, [-E file],[,-E, file,] these four basic elements are separated by a space.Same reason [!-e file],[,! ,-E, file,] each of

Shell command Tips--text to weight and maintain the original order

In short, this technique corresponds to a scenario such as the followingAssume that there is text such as the followingccccaaaabbbbddddbbbbccccaaaaIt needs to be re-processed now. This is very easy,sort-u, but suppose I want to keep the text in its

Shell Script Programming Basics

The shell itself is a program written in C, which is a bridge for users to use Linux. The shell is both a command language and a programming language. As a command language, it interprets and executes user-entered commands interactively, and as a

Encrypt a shell script

Automated maintenance of the system with shell scripts is simple, convenient and portable.But shell scripts are read-write and are likely to leak sensitive information, such as usernames, passwords, paths, IP, and so on.Similarly, sensitive

Shell Programming Notes

#!/bin/bashecho "Hello world!"1. As an executable programSave the above code as test.sh and CD to the appropriate directory:chmod u+./test. #使脚本具有执行权限 ./test. #执行脚本2. As an interpreter parameterThis works by running the interpreter directly, whose

Shell Script Learning notes (stream editor sed)

      sed means Stream editor used as a filter in shell scripts and makefile is very common Sed not only supports the normal form. It has some other powerful features.Let me give you a sample to see if there is any way to solve it.hello

Post a shell script for future reference.

1#! /bin/Bash2 3icms_path=$ (CD $ (dirname$0);pwd)4deploy_path=$ (CD $ (dirname$ICMS _path);pwd)5jar_file= $DEPLOY _path'/dailydata-1.0-snapshot.jar'6ini_file= $DEPLOY _path'/cnedmp_etl.ini'7log_file= $DEPLOY _path'/shellrun.log'8coding='GB2312'9

JMeter Bean Shell Use (ii)

Previous JMeter Bean shell Use (a) a brief introduction of the bean shell in the next jmeter, this article is a supplement to the above, mainly summarizes the common scenarios and methods, I believe these basic can cover most of the needs. This

Shell Scripting Learning Notes (normal form)

in general, there are three parts, each of which are: character class , quantifier, position qualifier. Specifies that some special syntax denotes character class, numberVolume qualifiers and positional relationships, and then use these special

Shell Script 1.1

#环境变量Echo $HOSTNAME #主机名Echo $SHELL #目前用的哪个解释器Echo $PATH #命令搜索路径Echo $USER #使用的哪个用户Echo $PWD #当前目录Echo $HOME #家目录是哪个Echo $LOGNAME #哪个用户# positional variablesEchoecho $Echoecho $Echo $* #显示所有位置值Echo $# #显示位置值的总数量echo $$ # Process number PID of the

Python3 determine if the process exists in the shell && start && Email notifications

Determine if the process existsdefisrunning (process_name):Try: Process= Len (Os.popen ('PS aux | grep "'+ Process_name +'" | Grep-v grep'). ReadLines ())ifProcess >= 1: returnTrueElse: returnFalseexcept: Print("Check

Total Pages: 541 1 .... 294 295 296 297 298 .... 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.