1. Exec Read lineRushid = $ lineExec is a pipeline command, which is generally not used separately.Read from the CSV file and assign each line to lineRead is used to accept keyboard input in shell.
Line is a variable that accepts output parameters.
The find command is used for searching. It has powerful functions in the following format:
Find pathname-options [-print-Exec-OK...]
Pathname: directory path searched by the find command. For example, use "." To represent the current
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
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
Option-Y: The operation is performed without user confirmation.
Yum-y install : Install the specified software.
Yum-y update: Upgrade the software.
Yum-y update : update a specific file
Yum check-Update: checks whether software needs
Below is a simple Linux ShellCodeThe function is used to find the current directory and all its directories which contain the four characters "html" and print the file name, at first glance, there should be no problem with this code, but there are
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 *.
Special characters in Linux Shell
1. braces:
Usage 1: wildcard Extension
Eg: ls my _ {finger, toe} s
This command is equivalent to a combination of the following commands:
Ls my_fingers my_toes
For example: mkdir {usera, userb, userc}-{home, bin,
Comparison of strings and values in Shell
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"]-Ne is not equal to, for
$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
In actual project development, there are many applications that retrieve data from the database. The general solution is to write a data retrieval method. the SQL script is then called and obtained in the shell program. In fact, these two steps can
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
Summary of Linux Shell shortcut operations (including shortcut keys and efficient operations ):
CTRL +: Start with the command line
CTRL + E: End of the command line
CTRL + L: Clear screen, equivalent to the clear command
CTRL + u: Cut the content
In shell scripts, you often need to obtain the system time to process an operation. Today, the system learns how to obtain the system time. The record is as follows:
Linux system time can directly call system variables in shell, for example:Get the
Chapter 4 directory operations
4.3.1 column directory
$ Ls directory
-D option, force to display only the directory name, not the content
4.4 operation directory
4.4.1 create a directory
Mkdir directory
Example: $ mkdir hw1
Create the hw1
Lesson 6 variables
Part 2 shell programming
7.1 define variables
Format: Name = value # Note: there cannot be spaces on both sides of the equal sign!
This is different from other scripting languages: value can be defined as a variable value without
14th class hour Functions
14.1 create and use functions
Format: Name () {list ;}
An important feature of Shell functions is that they can be used to replace binary executable files or shell built-in commands with the same name.
For example:
CD () {
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service