Linux Shell script basic learning (5)

The Linux Shell script has been divided into several parts, and the content of the control process is now finished. This is the last part about here document. The example here is a little complicated, we will analyze this complex Linux Shell script.

Hot Backup of shell script files every three hours

Mysql1 # Cat mysqlbackup. Sh#! /Usr/local/bin/fish # The backup policy is daily full backup # Setting backup path variables Set backupdir/usr/DB/backup # Generate a backup directory Mkdir-p $ backupdir # Delete a backup that has been backed up for

Linux Shell script basic learning (3)

Linux Shell script basic learning Lecture 3: When we introduced shell commands and Process Control in the previous section, we could not talk about process control due to space limitations, today, we will only introduce the first three parts of if

Linux Shell script BASICS (7)

Linux Shell script basics if you only look at the previous theoretical section, although there are some examples, but it is not systematic enough, here we will show you a specific example of Linux Shell script programming, to help you learn and

Shell batch rename objects by date

In the case of a lot of service logs or a lot of scattered files that need to be sorted together in batches, the shell script can be quickly used to solve the problem: Date = $ (date + % Y _ % m _ % d-% H % m % s); find *-type F | while read file;

Shell flow control statements

Conditional statement if-then Structure If [condition]ThenCommandsFi Note: To put then and if in the same row, you need to write the following:If [condition]; thenIn shell. In addition,There must be a space between [] and condition !!!For more

Linux Shell variable configuration code

Variable configuration rules The variable and the variable content are linked with an equal sign "=", as shown below:"Myname = vbird 』 The equal sign cannot be directly followed by a space character, as shown below:"Myname = vbird" or "myname

Export of Linux Shell

Export makes the environment variables defined in the parent shell still valid in the Child shell.   Eg: [Oracle @ ora10g ~] $ Echo $ AA [Oracle @ ora10g ~] $ Echo $ BB [Oracle @ ora10g ~] $ AA = aaa [Oracle @ ora10g ~] $ BB = BBB [Oracle @

Shell if usage

-B. returns true if the file exists and is a block file.-C: returns true if the file exists and is a character file.-D. If pathname exists and is a directory, true is returned.-E: returns true if the file or directory specified by pathname exists.-F

Introduction to some special symbols in Shell

Common special symbols in shell are listed as follows:#;.,/\ 'String' |! $ {}$? $ * "String "***?: ^ $ # $ @ 'COMMAND '{} [] [[] () | & {XX, YY, ZZ ,...}~ ~ + ~ -& \ +-% =! = Output/input redirection>>>&> 2 &> 2 <>>&> & 2 # Comments)This is almost

[Erlang 0076] A strange problem with Erlang Shell

  I have been busy recently, and occasionally spend some time reading books to supplement my energy. Recently I am studying programming languages-I am very touched by the road to practice. What I 've learned by mistake is a more system, the complete

Simple shell sorting and statistics.

During the bug quality analysis, the word segmentation should be sorted and de-duplicated, so we thought of sort and uniq. It is very convenient to call shell through python. #-*-Coding: UTF-8 -*-Import OSImport sysDef cws_statistics (flag, afile,

Shell script-Batch rename

If you have a small requirement at work, you need to rename a series of files. The original format is string_1.obj. Now you want to change the number in the file name to a fixed length. If the number is less than the number of digits, it is changed

Introduction to Shell 1

All Unix users should understand how to use the Korn shell script. By writing shell scripts, You can automate many tasks and save a lot of time. It seems daunting at first glance, but you can use it skillfully as long as you follow the correct

Common shell commands

How to extract the line Content Code specified by the file: If you only want to view the first five lines of the file, you can use the head command,For example: Head-5/etc/passwd If you want to view the last 10 lines of the file, you can use the

If judgment for Linux shell scripts

  LinuxIf command WhateverProgrammingLanguage is inseparable from conditional judgment. Shell is no exception.If list thenDo something hereElif list thenDo another thing hereElseDo something else hereFi Ex1:#! /Bin/shSystem = 'uname-S' #

Self-decompressed tar files using Unix shell

In Windows, there are some files that can be decompressed by yourself, that is, the so-called self-decompressed files. You don't need to know which compression technology is used to compress the file, you can simply decompress the file by running

Shell basic knowledge 2

Conditional expression: 1. File expression # If the file exists if [-f file] # if the directory exists if [-d dir] # if the file exists and is not empty if [-s file] # if the file exists and is readable if [-r file] # if the file exists, you can

How to Learn shell commands in Linux

How to Learn shell commands in Linux I learned some of the scattered linux commands today. The following is a summary: First of all, when you don't know how to execute commands, of course we need man. Let this man save everyone! Haha! Common network

How to obtain data from shell pipelines in different languages

Shell: #! /Bin/bash #=============================================== ====================================## this example show you how to get data from pipe #====== ========================================================== =============== while

Total Pages: 541 1 .... 509 510 511 512 513 .... 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.