Each line read by shell from a standard input or script is called a pipeline; it contains one or more commands ), these commands are separated by one or more pipe characters (|.
In fact, there are many special symbols that can be used to
I found an example online, which is simple and practical as follows.
There can be a background process that takes some operations when timer times out.
#! /Bin/KSh # delaytime = 0 alarmhandler () {echo "Get sigalam" killsubprocsexit 14}
Original article link
Before using sshpass, see
Shell script Automation
Automatic SSH logon methods
1. Automatic ssh/SCP Method =
A is a local host (that is, a machine used to control other hosts );B is the remote host (
Replace file1 with the actual file as follows
1. query the row number of the empty row in file1.Grep-n "^ $" stl_stable_sort.ccRefer:Common grep commands
2. query the rows ending with ABC in file1.Grep-n "^. * ABC $"
My colleague asked me a question about awk today. It means that the several rows of data obtained through the awk operation are not fixed. You need to store the obtained rows of data in an array and do not want to use loops. After one afternoon's
When accessing the ps1 file, be sure to check whether the access path contains spaces.
Spaces must be enclosed in single quotes.
PowerShell-command Set-ExecutionPolicy "Bypass" set filepath = '% CD % \ AppDeployment. ps1 'powershell-command "& %
Shell script:
1 ,#! Shell for Script Execution2. # comment3. Command or syntax structureEcho "input content"Empty line output by echo
Run:
1. shell scriptSh example2. Grant shell script execution permissionChmod u + x example
Case: example sysinfo.
&&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!
Meaning of "2> & 1" in linux shell
Script:
Nohup/mnt/Nand3/H2000G>/dev/null 2> & 1 &
For & 1, it should be file descriptor 1, while 1 generally represents STDOUT_FILENO. In fact, this operation is a dup2 (2) Call. it outputs the standard output to
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 |
1. print some header informationCommand ............Dilimiter
Use the content in the demarcation symbol dilimiter as the standard input of the commandIt is often used in echo commands, which avoids the use of an echo command when no line is output,
1. backup_run.sh
Copy codeThe Code is as follows :#! /Bin/sh
# Backup_run
# Script to run the backups
# Loads in a setting file for the user to change
SOURCE =/home/bob/backup. defaults
Check_source ()
{
# Check_source
# Can we load the file
#
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-
1. Basic Concepts
A, I/O redirection is usually related to FD, and shell FD is usually 10, that is, 0 ~ 9;
B. There are three commonly used FD types: 0 (stdin, standard input), 1 (stdout, standard output), and 2 (stderr, standard error output ),
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"]
The color of the text terminal can be generated using an ANSI unconventional character sequence. Example:
Echo-e "\ 033 [44; 37; 5 m ME \ 033 [0 m COOL"
The above command sets the background to blue, foreground white, blinking cursor, output
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.