When using shell in Linux, arrays are occasionally used for convenience. The declaration method of the array is:
Array = (element1 element2 element3... elementn)
That is, wrap the array elements directly with parentheses, and separate the array
During this period of time, I was engaged in big data research. Where should I find a large amount of data? Well, some automatic generation tools on the Internet do not meet my own needs, so I wrote one myself, A script that can generate a large
Many people think that, like passwd and Su, Telnet cannot work automatically through pipelines and input redirection, but in fact Telnet supports input redirection. although, strictly speaking, shell scripts cannot enable telnet to enter the
Digress: Recently, due to an attempt, we installed and set the highly recommended zsh to replace the default Bash. After a while, we found that there were a lot of things, but the same problem was also exposed, for example, there is a problem with
The third party is ours.
1. Path
The environment variable $ path does not wrap the line, and it looks very difficult. Path outputs the $ PATH Branch
Echo-e $ {path //:/'/N '}
2. classpath
Similar to path
Echo-e $ {classpath //:/'/N '}
3.
Use Find and SED
# First query the number (sed-N)
Find.-Name '*. htm' | xargs sed-n'/old/P'
# Replace (sed-I)
Find.-Name '*. htm' | xargs sed-I's/old/new/G'
Use grep and SED
Grep-l old *. htm | xargs sed-n "/old/P"Sed-n'/old/P' grep-l old *.
Document directory
1. Use of shell Array
2. awk Array Operations
3. shell parameter problems
4. How to output single quotes in awk
5. Methods for connecting awk and shell strings
1. Use of shell Array
Value assignment: All = (6 5 4 3 1 8 9 10)
Variable:
Local variable: valid only for the current
Environment variable: valid for both the current shell and sub-shell
Export A = 3 define a as a variable and assign 3 to
A = 3
Export a reference does not need to be added &
Export also views
Two days ago, I wrote about how to use the host RedHat system to streamline, call, and modify the system to create a tiny Linux of my own!
See: http://blog.csdn.net/wei2856059/article/details/6654801
However, many people are lazy ~~, So I
Sometimes in bash shell, we need to obtain user input information, such as user name and password. The password cannot be displayed... In the face of such requirements, the practical command read can be implemented.
Read-P "input your Username:"
How to extract the line Content Code specified by the file:
If you only want to view the first five lines of the file, you can use the head command,For example: Head-5/etc/passwd
If you want to view the last 10 lines of the file, you can use the
$0 script execution name
$ N the nth parameter value of the script, n = 1 .. 9
$ * All parameters of the script
$ @ All the parameters of the script (which have similarities and differences with $)
$ # Script parameter count
$ PID for Script
Shell has two built-in variables about time,You have never used it,I have never used it,Today is also the first time to see,So I added a note,For future reference.$Seconds: the time when the script has been run.(In seconds).$TmoutIfTmoutThe
This document describes the basic usage of sed. We recommend that you take a look at the details of SED and awk In the third edition. Sed matches the regular expression to output the command to process the text, it is a headache to be unfamiliar
I. Io Devices
Io is the source and destination of the index data, which are called standard input, standard output, and standard error output.
Programs do not have to worry about device issues, such as files, terminals, and tape drives.
By default,
Ninth cycle
Basic Syntax:
While command
Do
List
Done
Single Row format:
While command; do list; done
For example:
X = 0
While [$ X-LT 10]
Do
Echo $ x
X = $ x + 1
Done
While loops are most commonly used to check whether user input is obtained
Monitor wwwa.applevb.com by using undisclosed Functions
In Windows, there is an undisclosed function shchangenotifyregister. You can add it to the system message monitoring chain in your window. This function is available in Delphi.Is defined as
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.