Use of the special variable IFS in shell, and the difference between the value of $ '\ n' and' \ n', shellifs
When a for loop is used in shell, the IFS is also used to define the separator. To specify multiple IFS characters, you only need to
1. The Function Definition Format in shell is:
Function name (){
# Function body
}
The function definition must follow the principle first defined in use, such as defining the function print
#!/bin/shfunction print(){if [ $# -lt 1 ]then print “no
Special variable IFS in shell
As I get used to the writing style of python, I often want to use bash to traverse the lines of a file and process the lines read.
But in a strange situation, if my text is similar to this
The first line.The second
The braces and parentheses in shell I want to talk about here are several types of shell parentheses, the structure of braces and the variables in parentheses. The command usage is as follows: www.2cto.com 1. $ {var} 2. $ (cmd) 3. () and {} 4. $
The scope of the script variables and function variables in Shell defines the function in shell to modularize the code and facilitate code reuse. However, the variables and functions of the script itselfThe scope of the variable may be confusing.
Test switch and special parameters in Shell script, shell script1. Test Switch
The following table lists the meanings of the test commands and whether they can be used in test commands, bash, and ksh.
Switch
Test
Bash
Ksh
Variable assignment
Variable access
Variable input
4.1 variable assignment
In shell programming, all variable names are composed of strings and do not need to be declared. To assign a value to a variable, the format is as follows:
Variable
In shell, you can use export to modify the environment variables of the current process. For example,Export Path =.: $ pathYou can add the current path to the executable file search path, so that you do not need to press "./excutable" to execute the
Commands commonly used in shell scripts: wget, Curl, SS, Lsof, Nmap, NC, netstat, telnetLab Environment Description:(1) The port used by the remote Nginx Server Ip:192.169.5.136,nginx service is 80;(2) ip:192.169.5.121 of local CeshijiCommon
Reprint: http://www.cnblogs.com/lr-ting/archive/2013/02/28/2936792.htmlecho Display in shell script with color display, echo display with color, need to use parameter-EThe format is as follows:For example:Where 41 of the position represents the
A variable is a quantity whose value can vary; In essence, a variable name is a memory space for storing data;The variables have local variables and environment variables;A shell variable is a weakly typed variable that does not need to specify its
I. Command substitutionA. in Bash, $ () and ' (anti-quote) are used for command substitution.B. command substitution is similar to variable substitution, which is used to reorganize the command line, complete the command line in quotation marks, and
This article mainly introduces some special symbols and its function in shell script, summary is very concise, easy to understand, the need for friends can refer to the next
In writing shell scripts, we need to use a variety of special symbols,
Origin: In the old boy Linux training shell programming teaching, found a lot of good level of friends and classmates are still very confused, the following for everyone to share the use of the array of small examples, I hope to give you a little
This article mainly describes the shell script in the execution of SQL statements 5 ways to operate MySQL, this article explains the SQL statement embedded directly into the shell script file, the command line calls a separate SQL file, using the
In shell scripts, there are some common special variable representations that need to be known.Here are some of the frequently used special variable representations:$ Current PIN name$ ... Parameters of the incoming script or function (greater than 1
Shell Script Introduction
Shell is a scripting language Aming_linux (public number) blog.lishiming.net (blog)
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The shell is a collection of system
In shell, there are three types of quotation marks: single quotation marks, double quotation marks, and reverse quotation marks.
Single quotation marks 'all characters enclosed by single quotation marks are common characters. When special characters
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.