1. netstat
1) netstat [Option]
Parameter descriptions related to routing:
①-R: lists the route tables. The function is similar to the route command;
②-N: The Host Name and service name are not used. The IP address and port number are used,
1. Shell expression
A = 3; B = 2; C = 4
If (A> B) & (A
Or
If [[$ A> $ B] & [[$ A
Or
If [$ A-GT $ B-A $ A-lt $ C]
2.-O = or,-A = And, but I have always used | or &&
3. Other explanations
-Ne comparison number (numberic );! =
1,! $ Is a special environment variable, which represents the last string of the previous command. For example, you may:
You can change it:
$ Mkdir mydir
$ MV! $ Yourdir#$ MV mydir yourdir
$ CD! $
2. ^ old ^ new
Replace some strings in
1.Use the value assignment statement:Format:LetValue assignment expression【Tip] The Value assignment expression can be omitted as follows:((Value assignment expression))Example: Give the independent variableIAdd1Let I = I + 1Or(I = I + 1) -----------
If there is no body file, use echo to directly extract the body, for example:
Echo "this is content" | mutt-s "this is subject"-A/path/Yourfile abc@local.domain-C bbb@local.domain
If there is a body file, use
CAT/path/contentfile | mutt-s "this
> Array
Names = (max Helen Sam Zach)
Names [*] extracts all data and returns it as an element.
Names [@] Retrieves all data, but returns an array, which can be used to assign values to the array.
> Export
Make the variables of the parent
Original article link
Cutting-edge
In the past, I wanted to write a bash-like GUI interface, so I had to use the libncurses library in C. I thought it was annoying.
With the dialog tool, you canProgramInUse shell script to complete
My family originally had two turtles, one father and one mother. I brought them back from Qingdao. When I bought them, I asked the stall owner what to eat. The stall owner replied: it is best to use a dedicated feed, said to take out a box of
Reference address:
The information returned by ifconfig includes the IP address, but it is troublesome to obtain the current IP address in shell.
Obtain Method
The formats of ifconfig returned information vary in different systems:[1]
Linux:
1. Special files:/Dev/null and/dev/tty
Linux provides two special files that are very useful for shell programming:/dev/null and/dev/tty. /Dev/null will discard all data written into it. In other words, when Program When writing data to this file,
Conditional Criterion
Just talk about 『Program", Then the conditional criterion, that is, the criterion" If then ", must be learned! Because in many cases, we have to determine how the program should proceed based on certain data.
If... then
What is shell scripts?
What is shell script (ProgramScripts? Literally, we divide it into two parts. In the "shell" section, we have mentioned in bash that it is a tool interface that allows us to communicate with the system under a text interface.
1. Create multiple entries or access points for the same file.
1) hard link: both the original file name and the connection file name point to the same physical address, that is, the original file and the hard connection file are the same file
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
After the CLR in-process side-by-side feature is introduced in. NET 4, we can use C # To compile Windows Shell. We can find related examples In Microsoft's All-In-One Code Framework. There are also several articles about it In the yard:
Windows
1. ftp automatically logs in to batch download files.
Copy codeThe Code is as follows: ##### migrate/home/data from the ftp server to the local/home/databackup ####
#! /Bin/bash
Ftp-n Open 192.168.1.171
User guest
Note: The subscript of the array in shell starts from 0 by default.
1. Place the string in an array to obtain its length.
Copy codeThe Code is as follows :#! /Bin/bash
Str = "a B -- n d"
Array = ($ str)
Length =$ {# array [@]}
Echo $ length
For (I
Read a file, assign each row to an array variable, and print it out in a for loop.
Copy codeThe Code is as follows :#! /Bin/sh
I = 1
SUM = 'sed-n' $ = 'tmp.txt '# calculates the total number of lines in the file.
Echo "$ SUM"
While read line
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.