The source command can load another script in one script. The following is an example:
First, we define a function script named myfunc. Sh, as follows:
#! /Bin/bashFunction Square{Local tempLet temp = $1*$1The sum of squares of Echo "$1 is: $ Temp"
The case expression can be used to match a given string, not a number (do not confuse switch... case in C ).
Case... in...) do something here esac
The file command can identify the file type of a given file, for example, file lf.gz. The output
FTP-I-v-n
FTP download, open IP port is the connection server, User Username Password is the login, CD/admin is the CD to the Admin directory under the FTP server, LCD D: /Shell/data is used to change the local working directory to the
I learned the shell script today and copied a simple script on the Internet as follows:
#! /Bin/bashCygwin = true# Assign values to variables:A = "Hello World" # No space exists on both sides of the equal sign# Print the value of variable:If $
Compare shell strings and determine whether the string is a numberBinary comparison operator, which compares variables or numbers. Note the difference between numbers and strings.
◆ Integer comparison
-EQ equals to, for example, if ["$ A"-EQ "$
Tangent to Vertex
Returns a convex polygon.P, TangentLIsPIntersection andPInternalL.
This concept is similar to orthogonal tangent.
Pair of vertex points
If two verticesPAndQ(BelongP) In the two parallel tangent lines, they form a pair of
A simple shell Backdoor
Author: Pony/smallhorse [e.s. t VIP] (it doesn't matter if you do not write this e.s. t VIP)Source: evil baboons China
Recently, I was bored and thought about writing a simple shell backdoor. At the same time, anti-virus
TR is used to delete control characters in a file or convert characters.Syntax: TR [-C/D/S/T] [set1] [set2]Set1: Character Set 1Set2: Character Set 2-C: complement. Use set2 to replace characters not included in set1.-D: delete all characters in set1
Do you still remember the regular expression that used to calculate prime numbers? The world of programming is so interesting that you will always be able to see something special. Have you ever thought that you can put your variables and functions
2011-04-23 wcdj
The method for learning shell program design is: Hands-on + man command
The following scripts are all tested in cygwin.$/Bin/Bash -- versionGNU bash, version 2.05b.0 (1)-release (i686-pc-cygwin)Copyright (c) 2002 Free Software
This article is the fifth chapter of Flow Control in learning the bash shell 3rd edition, but we will not limit it to this. Flow Control is a common part of any programming language and includes bash. Here we will learn about them.
If/else is used
Note: No space is allowed between the left and right sides of "=". The semicolon program 1 # is not required at the end of the bash statement #! /Bin/sh # echo somethingecho "Hello World" Echo "Hello !! "CD/root/export topmkdir./ABC Program 2,
$1 indicates the first parameter. $ * indicates all parameters entered by the user.
The hello1 script is as follows. A location parameter is acceptable.
#! /Bin/bash
Echo $1
Run the Script:./hello1 "Hello World" and output Hello World on the
The Select expression is a bash extension application, especially for interactive use. You can select from a group of different values.Select VaR in...; doBreakDone... Now $ VaR can be used ....The following is an example:#! /Bin/shEcho "What is
The Common commands of ADB shell in Android and the methods for viewing application database information under cmd are as follows:
CMD -- ADB shell: Enter the shell command interface of the simulator.
Ls displays all the file directories in the
1)
Create
FunctionName {
...
}
Or:
Name (){
...
}
2)
Call
Use the function name directly. The function can be called only after it is defined;
When a function has the same name, the new definition will overwrite the old definition and no
Ls
-L, show the hard link count;
-I, show I-node
-H, human readable
-T, sort by modify time
-S, sort by size
-R, -- reverse
-R, show content of sub-Dir
-V, sort by version
CP
-P,Retain source file attributes, such as the modification time
-L,
In awk programming, do not forget that awk processes regular expressions. There are many internal functions, especially string processing functions. Calling these functions can reduce the workload.
1. Format
// Note \ There cannot be spaces behind
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