There is a ' batch ' file in DOS that writes multiple commands into a batch called. bat.In Linux, it can also be done, and more powerful, I write batch processing is in Ubuntu 12.04 LTSAll I have to do is move the pictures on the USB drive to the
Cat/proc/meminfoCat/proc/cpuinfoIpcs-aIpcs-mIpcs-sIpcs-qMkdir-p name when the parent directory does not exist is to create itINFOCMP VT100Echo $TERMXtermKonsoleGetconf Long_bitArchRelease= ($ (Lsb_releaseCD-RZ szecho $PS 1Ls-f (after the directory
Code block redirection refers to redirecting standard or standard output to a file within a block of code, or leaving the default state outside of a block of code, in other words, code block redirection refers to the redirection of standard input or
Automated Format Partitioning method ---- non-interactive --- available for scriptingTo give the user a hint first, let him select a partition to formatFor i in ' mount|grep '/dev/sdb ' |awk ' {print '} 'Dofuser–km $i; Umount $iDoneDD If=/dev/zero
Twenty. To get the system run data through the pipeline Combination shell command :1. Output the 5 most memory-intensive commands in the current system:#1) Lists all the processes that are running on the current host through the PS command.#2) The
#! /Bin/bash
While[1]
Do
A = $ (ifconfig eth0 | grep'Rx PAC'| Awk'{Print $2 }'| Awk-F:'{Print $ NF }')
Echo-ne"$ A \ r"# Refresh data without line breaks
Done
Echo Parameter number:-N. Do not wrap the line at the end.-E
Sed: A stream editor or a row editor. Sed processing process: sed reads a row from the source file and places it in a temporary buffer zone. This buffer zone is called a mode space and uses the corresponding mode to process the mode space, the
Tag: $ {} ''$ () Shell
$ (), ''For command replacement
$ {} Is used to replace variables (the following content is from shell 13)
(1). Definition of Variables
$ A=B $ echo $AB
When executing this command, the AB is regarded as a
(1) it must start with the following line (the first line of the file must be placed ):#! /Bin/shSymbol #! The program used to tell the system to run the script. This example uses/bin/sh. After the editing is completed and saved, it is assumed that
#! /Bin/bash
# Prompt user input
Echo-n "Please enter number"
Read N # Put the input value into Variable N
SD = 0
REV = ""
On = $ N # Save the value of Variable N to the variable on for later use
Echo "you put number is $ N"
While [$ n-GT 0]
I. Regular Expression description
· Concept: Describe data with common attributes with a string of characters
· Note: when using regular expressions for matching, be sure to use the \ transfer symbol.
· Format:
A. grep [Option] 'regular expression'
After we grant the shell script execution permission, we can test the program. Assume that the shell script file is hello. Sh.In the/root directory. The following describes how to execute shell scripts on a terminal:1. Switch to the directory where
The problem is as follows: perform a loop based on the number of Script Parameters $ #, and output each parameter $1 $2 $3 in sequence ...... I have a loop variable I $ I. When I get this variable I is 1, I want to use this 1 and then call $1, that
Convex hull diameter
Detailed description of convex hull diameter
// Calculate the convex hull diameter. Input convex hull Ch. The number of vertices is N, which is arranged counterclockwise. The square of the output diameter
Int rotating_calipers
#! /Bin/bash # program: # lzsh server log filter # History: #2014/07/01 Kom first release #2014/07/03 Kom remote and multi-Param support # Set pathpath =/bin:/sbin: /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin :~ /Binexport path # Set Script
? Time when the file is read
#! /Bin/bash
For file in 'ls/root'
Do
Stat $ File> 1.txt
Sed-n "7 P" 1.txt> 2.txt
Usetime = awk-F ":" '{print $2}' 2.txt
Echo "time =" $ File $ usetime
Done
? The while statement that reads each row of a file.
Cat afile |
Note: you must first install an email server such as Postfix or Sendmail.
1. Apache
#!/bin/bash#apache.shnc -w2 localhost 80 if[ $? -ne 0 ]thenecho "apache is down,please check" | mail [email protected] -s "apache is
Time when the file is read
#! /Bin/bash
For file in 'ls/root'
Do
Stat $ file> 1.txt
Sed-n "7 p" 1.txt> 2.txt
Usetime = awk-F ":" '{print $2}' 2.txt
Echo "time =" $ file $ usetime
Done
The while statement that reads each row of a file.
Cat afile |
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