Day Fifth: Functions and task scheduling
Advantages of the function
Divide and conquer F
Work together
Easy Management
Easy Maintenance
Structure of the function
function functions name ()
{
Command 1
Command 2
Command 3
}
Parameter
Known three time variables:time1= "Fri Aug 23 11:35:21"Time2= "Mon Sep 2 16:18:09"Time3= "Tue Sep 3 16:06:33"Given that these three times can be determined to occur in 2011-2013, how quickly to determine what year it is?
Want to output:time1= "2013/
Objective
Now every time you analyze the site log, you need to judge Baidu Spider is not the real spider, nslookup after the need to determine whether the results include "Baidu" string
Here are some of the methods that are included in the
It hasn't been updated in a long time.Think you should continue reading the script.
#14 Formatting Long Lines
#!/bin/sh
# A version of FMT, using Nroff. Adds Two useful flags:-W X for line width
# and-h to enable hyphenation for
Using shell script to automate the maintenance of the system is simple, convenient and portable.
But shell scripts are readable and writable, and are likely to reveal sensitive information, such as user name, password, path, IP, and so on.
*-B Returns True when file exists and is a block file
*-C Returns True when file exists and is a character file
*-D returns True when pathname exists and is a directory
*-E Returns True when pathname specified file or directory exists
*-F returns
Ctrl + a switches to command line start
Ctrl + e Switch to the end of the command line
Ctrl + L Clear Screen contents
Ctrl + U Clear the contents before the clipping cursor
Ctrl + K-cut to clear the contents after the cursor
Ctrl + y Copy the
I am also a novice, write a bit old-fashioned, right when practicing, for beginners friends reference it.
Copy Code code as follows:
#!/bin/bash
If [$SUCC _ping-gt $ ((ping_count-1))];then
If [F./alarm_file/alarm_$host];then
Today, another Linux production environment to build. This is a lot of steps, very cumbersome and have to do things. Although many times, but there are many steps, orders do not remember, every time looking for information is troublesome, so take
In simple terms, this technique corresponds to the following scenario
Suppose there is text as follows
Copy Code code as follows:
Cccc
Aaaa
bbbb
dddd
bbbb
Cccc
Aaaa
Now it needs to be processed, this is simple,
Port forwarding under Windows is typically a self-contained NAT and Porttunnel, Portmap
Linux Lower port forwarding mapping program called RINETD, boot method rinetd-c/etc/rinetd.conf, Pkill rinetd shutdown process
Tools Home:
#!/bin/bash #extracting command text_text_text_line options as Parameters Help_info () {echo "NAME" echo "\t$0" Ech O "Synopsis" echo "\t$0 is a shell test about process Options" echo "DESCRIPTION" echo "\toption like-a-B param1- C param2-d "} If [$#
Demand
I wrote this script two days ago when I met the need to extract a file in a 10-story folder.
A file structure like the following:
Copy Code code as follows:
Dir1
├──a
│├──b
││└──file1
│└──file2
├──c
│└──d
│├──e
Many of the shell scripts executed with Cron may take a long time to execute for a variety of reasons, and it is necessary to check whether they are still running while running. This article provides a Linux shell script to check with the command sh
Shell echo CommandDisplay Normal string:echo "I am cat_crazy."Note: The double quotes here can be omittedShow escape characters:If you want to output quotes, the * number needs to be escaped to output, as followsecho \ "I am cat_crazy\"The output is
1. Document CollationWork number and name are recorded in the employee fileEmployee.txt:Jason SmithJohn DoeSanjay GuptaAshok SharmaRecord work number and salary in bonus fileBonus.txt:100 $5,000200300 $3,000400 $1,250Requires merging two files and
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