Analysis of Shell custom functions and parameter calls

I. define functions CopyCodeThe Code is as follows: function fname () { Statements; } OrCopy codeThe Code is as follows: fname (){Statements;} Ii. Call Functions You can call a function by using the function name:$ Fname; # execute a

Back up the shell script code of the website content

Back up website content Copy codeThe Code is as follows :#! /Bin/bash # Specify the running script shell # Run the script to grant the user the execution permission Bakdir =/backup Month = 'date + % m' Day = 'date + % d' Year = 'date + % y'

Shell scripts for two backup Databases

Back up database shell script 1 Copy codeThe Code is as follows :#! /Bin/bash # Specify the running script shell # Run the script to grant the user the execution permission Bakdir =/backup Month = 'date + % m' Day = 'date + % d' Year = 'date + %

Introduction to searching and replacing Shell script Learning Guide

3.1 search for textGrep: use the basic regular expression (BRE) defined by POSIX ).Egrep: use an extended regular expression (ERE ).Fgrep: Quick grep. Use an optimized algorithm to match a fixed string instead of a regular expression. 1992 POSIX

Introduction to linux shell udfs (definitions, return values, and variable scopes)

1. define the shell function (define function) Syntax:[Function] funname [()]{Action;[Return int;]}Note:1. It can be defined with function fun () or fun () without any parameters.2. If the parameter is returned, the value "+: return" is displayed.

Shell-written alarm count control and recovery sample code

I am also a newbie. I am a little old-fashioned. I am a good trainer. It is a reference for beginners. Copy codeThe Code is as follows :#! /Bin/bash If [$ succ_ping-gt $ (ping_count-1)]; then If [-f./alarm_file/alarm _ $ host];

Shell script for real-time file shunting in the background

Copy the files in the bill folder to the bill1 and bill2 folders according to certain rules (file name parity.Update the progress tag of bill1 and bill2 (Update file. max)File3 is the label of the latest file under the bill directory. It is updated

Shell script code for concurrent database stress testing

Copy codeThe Code is as follows :#! /Bin/bash #********************************# # Run fun in the concurrent background # # For wanggy 2012-01-25 # # Note :# # Fun_num number of times the fun function runs in the background # # SQL _num SQL

Shell script for sending LOG Category numbers via SMS

Copy codeThe Code is as follows :#! /Bin/bash # Telno is used to query the number list file # Sendsms. log is the text message sending result File #1 indicates that the message is successfully sent. Query_sms () { > Submit_telno >

Bash Shell script learning Summary

1. Character truncation: For normal path truncation, you can use the basename and dirname tools:Basename can intercept a file name from a file path. For example: Copy codeThe Code is as follows: $ basename/home/file.tar File.tar Dirname can be

Linux SHELL if command parameter description

*-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 returns true if pathname exists and is a directory *-E returns true if the file or directory specified by pathname exists.

Shell string comparison to determine whether it is a number

Binary comparison operator, which compares variables or numbers. Note the difference between numbers and strings. Integer comparison -Eq equals to, for example, if ["$ a"-eq "$ B"]-Ne is not equal to, for example, if ["$ a"-ne "$ B"]-Gt is greater

Prevents repeated code execution by shell scripts

For example, to require scripts to only access a certain resource in sequence, such as disk files, you can refer to the following implementation. Copy codeThe Code is as follows :#! /Bin/bash # # File locking using bash. # Ver 0.1.6 # # Author:

Common shortcut keys for linux shell commands

Ctrl + a switch to the command line Ctrl + e switch to the end of the command line Ctrl + l clear screen content Ctrl + u clear the content before cutting the cursor Ctrl + k cut the content after clearing the cursor Ctrl + y copy the content

Linux Command Line and shell script programming book Richard Blum

First script file Copy codeThe Code is as follows :#! /Bin/bash Echo "This is my first bash code! " Exit 0 Redirection symbols and mathematical computationCopy codeThe Code is as follows :#! /Bin/bashEcho-n "The time and date are :"DateValue1 = 100 #

Summary of shell mathematical computation

1. Example of an error method A) Var = 1 + 1 Echo $ var The output result is 1 + 1. Tragedy. B)Var = 1Var = $ var + 1Echo $ varThe output result is 1 + 1, which is still tragic. 2. Correct Method1) Use letVar = 1Let "var + = 1"Echo $ varThe output

Two very detailed shell instance code

Two very detailed shell instances General programming steps Now let's discuss the general steps for writing a script. Any excellent script should have help and input parameters. And write a pseudo script (framework. sh) that contains the framework

Fourth day of linux Shell Study Notes

The scripts for this lesson are also shared in share. Day 4: cyclic structure Content outline: Application Instance Analysis For Loop While Loop Principle of for Loop Achieve results According to yesterday's menu modification. After selecting 1, 2,

Next day of linux Shell Study Notes

Variable Get local host name# Hostname Obtain the System Version Number# Uname-r Obtain CPU type Obtain the cpu operation frequencyCat/proc/cpuinfo Obtain memory usage# Free-m Obtain hard disk usage# Df Variable types and variable operations

First day of linux Shell Study Notes

The following are Shell Study Notes for 1-2 days: --------- I am a separator --------- Hardware is executed, and operations are performed between the kernel and hardware. Command parser. Shell script Components System commands Text processing

Total Pages: 541 1 .... 400 401 402 403 404 .... 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.