Shell Introductionbash programming, then start with the programming, What is the program first? Personal words Explanation: program is the process of processing data. So, The program design consists of : program = data structure +
Because I usually write some small experimental script, every time to write author,description and so very troublesome, then wrote such a script can create their own small script, code as follows, pure personal original, relatively rough, big God
Read Catalogue
Numerical test
File test
String test
The test command in the shell is used to check if a condition is true, and it can be tested in three ways, such as numeric values, files, and characters.
-------------------------------------------------------------------------------------Regular expressions and wildcard characters:1. The regular expression is used to match the qualifying string in the file , and the Regex contains the match . grep,
character
meaning
*
Match 0 or more characters
?
Match any one character
[list]
Match any single character in the list
[!list]
Matches a character other
1. Describe the operation principle of shell program (can be attached with necessary graphic instructions);
Span style= " font-size:12px;">shell is a special program that is officially defined as the interface to the kernel and is
#!/bin/sh# Licensed to the Apache software Foundation (ASF) under one or more# Contributor license agreements. See the NOTICE file distributed with# This work for additional information regarding copyright ownership.# The ASF licenses this file to
Take the length of the variable
[[Email protected] scripts]# var=oldboy123[[email protected] scripts]# echo ${var}oldboy123[[email protected] scripts]# echo ${#var}9# For example: #以下判断用read输入一个值, if the length is 0, The value is empty,
Medium brackets [
and the test command equivalent, the user Boolean judgment, such as:1 a='abc'2if'abc' ] 3 Then 4 " Yes " 5 Else 6 " No " 7 FiEquivalent to1 if ' ABC ' 2 Then 3 " Yes " 4 Else 5 " No " 6 FiWhen using [], be
#!/bin/sh# Describe:check the real server status# history:2015-08-25 22:21:38# Author:timPath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binExport PATHvip=192.168.1.121dip=192.168.1.112rip= ("192.168.1.122" "192.168.1.123")Vport=8
/*-------------------------------------------------------------------------------------------@ Black eyed poet --------------------------------------------------------------------------------------------*/A variable is a unit of computer memory
TopicWrite a script1. Pass a parameter to the script, this parameter is the user name;2. If the user exists, perform the following tasks* If the user's ID number is less than 500, display it as an administrator or system user;* Otherwise, display it
First, an array overviewArrays: Data StructuresData series, continuous multiple data, can be used to get related elements of the indexDeclaring an array:declare-e arraynameInitialization assignment:arrayname= ("STRING1" "STRING2" ... )Arrayname=
Encounter FTP to more than one machine problem, waiting for the last execution to execute the next, time will be longer, if you can simultaneously send files to multiple machines, you can achieve the purpose of saving time.Grammatical
Multi-thread Linux Shell script and linuxshell
In bash, we run (&) in the background to implement multithreading.
for((i=1;i
We have added {} & so that the execution in {} can be performed in the background. The above is equivalent to executing
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