1. When defining variables, You cannot leave spaces on either side of the = sign.egGender=femal------------RightGender =femal-----------Wronggender= femal-----------Wrong2. Conditional test statement [the symbol is left blank on both sides .]egif
If you want to add a character after a variable, you can use the following method: $value 1=home$value2=${value1}"="Echo$value 2 Add the string variable you want to add {}, and you need to put the $ out. The result of this output is: Home=, which
Shell Script (iv)(7) TR command#实现字符转换功能#-c string: Inverse string character set, that is, all character sets except for the string#-d string: Delete all occurrences of characters in string#-s: Deletes all occurrences of a sequence of characters,
Shell Script (v)4. Sed and awk(1) SEDA, common parameters#文件编辑工具, text files and standard input can be edited, the standard input is keyboard input,#文件重定向, string, variable, and pipe text.#-n: Do not print all rows to standard output;-e: Resolves
$# 是传给脚本的参数个数$0是脚本本身的名字$1 是传递给该shell脚本的第一个参数$2是传递给该shell脚本的第二个参数[email protected] 是传给脚本的所有参数的列表$* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过9个$$ 是脚本运行的当前进程ID号$? 是显示最后命令的退出状态,0表示没有错误,其他表示有错误
Difference:@*
Same point: All parameters are
ls command file, directory Operation commandLS Displays the current directory by defaultLs-a Show All Files hidden filesLs-l Display file propertiesLS-LH Display File sizeLs-lt display files sorted by modified time
cd Command Change
The shell is an interpretive programming language.The execution of an interpreted script file:When an interpreted script file is executed, the script file is committed to the kernel. The kernel sees the first line of "#! "#! is called when the
The shell is an interpretive programming language.The execution of an interpreted script file:When an interpreted script file is executed, the script file is committed to the kernel. The kernel sees the first line of "#! "#! is called when the
Http://c.biancheng.net/cpp/view/6998.htmlOpen a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is
For some reason, Xcode has helped me follow the thousands of development and on-line certificates that need to be removed from this part of the certificate: #dir="/users/ethan/library/mobiledevice/provisioning
1.3 Playing variables and environment variablesvariables are an essential part of any programming language and are used to store variables of various types. Scripting languages are mostly weak type languages (dynamic languages), meaning that when
1. PrefaceAlmost half a year did not write a blog, wasted a long time, work in the chores too much, their own more and more lazy. In order to spur their own growth, or to insist on writing a blog, record their growth.2. Shell Function
Use Whil for if to print a prime number less than 100#!/bin/bash#author Alvin#version 1.0.0#test for 1-100 Zhishua=2While [$a-le 100];DoZ=1for ((j = 2; $j If [$ ($a% $j))-eq 0];thenZ=0BreakFiDoneIf [$z-eq 1];thenEcho-ne $a "\ T"FiLet A+=1Done2 3 5 7
Linux operating system can be divided into shell and kernel two parts, kernel is the kernel, provides the core functions of the operating system. The shell is the shell, which is connected to the kernel (kernel) and the user. This means that the
A variable definition1 explicitly defined variable=xxx no spaces2 Read variable ReadingThe following two lines of code are written, reading name and namefamilyRead-p "Please input your name:" NameRead-p "Please input your whole name:" Name familyRun
When we are learning some frameworks, we usually invoke a script when we start the framework, and pass some parameters to the script, and the script will do different things depending on the parameters we pass, and the parameters we pass are the
Defining arraysArr= (1 2 3 4 5)accessing arrays# echo ${arr[0]}1Print all the values in an array# echo ${arr[*]}1 2 3) 4 5Print array length# echo ${#arr [*]}5The above defined array, the index can only be a number, the following will describe the
Several methods of shell script execution, shell scriptYou can execute shell scripts in the following ways:
1. The relative path method must be cd to the script path first.
[Root @ banking tmp] # cd/tmp [root @ banking tmp] #./ceshi. sh script
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