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
The DB2 tutorial is: use shell to extract and update DB2 data. The shell written for work needs to process the DB2 database
Program Use shell to extract and process DB2 data.
# SQL Definition
SQL = "select AAA, BBB, CCC from mytbl1"
#
Copy codeThe Code is as follows :#! /Bin/sh
# Desc: setup linux system security
# Author: corzd
# Powered by www.freebsdsystem.org
# Version 0.1.2 written by 2011.05.03
# Account setup
Passwd-l xfsPasswd-l newsPasswd-l nscdPasswd-l
&&Command 1 & command 2: If the command is successfully executed, run the command.[Jb]/usr/xxxx/ytcclb> ls-l test. SQL-Rwxr -- r -- 1 xxxx group 225 Nov 15 test. SQL[Jb]/usr/xxxx/ytcclb> cp test. SQL test. bak & echo "coping file OK! "Coping file OK!
Bash shell supports only one-dimensional arrays, but there is no limit on the number of parameters.
Declare an array:Declare-a array(In fact, you don't need to declare it. You just need to assign values to variables in the array mode. BASH knows
Extract the alert log shell script of oralce on the current day
Copy codeThe Code is as follows: #/bin/sh
# Get alert of everyday
# Then name of file is everyday_alert.sh
Dir = "/oracle/admin/bbdz/bdump"
Num = $ (cat-n $ {dir}/alert_bbdz.log |
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 + %
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
4.1 sort text
4.1.1 sort rowsIf the command line option is not provided, the entire record is sorted by the order defined by the current locale.In the traditional C locale, that is, the ASCII order.
4.1.2 sort by fieldsThe-k option is followed by a
Copy codeThe Code is as follows :#! /Bin/bash
# This script is used for describle CPU Hard Memery Utilization
Total = 0
Idle = 0
System = 0
User = 0
Nice = 0
Mem = 0
Vmexec =/usr/bin/vmstat
Which sar>/dev/null 2> & 1
If [$? -Ne 0]
Then
Ver = 'vmstat-
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
Compare shell strings and determine whether the string 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"]
1. Use pgrep to match the name
Copy codeThe Code is as follows: if test $ (pgrep-f $1 | wc-l)-eq 0
Then
Echo "the process does not exist"
Else
Echo "process"
Fi
The following is a supplement:Processes in the current system:
Apple @ ubuntu :~ $
Using openrowset for shell penetration
To get the SQL injection point, we first thought of the backup webshell. We threw it in the NB and found that the SQL error information was blocked and the physical path was not obtained. Then we wrote a PP
Day 5: function and Task Scheduling
Function advantages
Divide and conquer f
Collaboration
Convenient Management
Easy to maintain
Function Structure
Function Name ()
{
Command 1
Command 2
Command 3
}
Function parameter transfer
Passing parameters to
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,
When I first wrote this version by Ma, I tested the simplified and traditional versions 2003, which should be easy to use. I guess it is probably related to the patch ms06014 on 2003. Parse proposed a solution in the freezing point forum. I studied
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