One$n: Gets The nth argument of the current shell script, n=1..9, when n is 0, represents the file name of the script, if n is greater than 9, enclosed in curly braces like${10}.$*: Gets all parameters of the current shell and treats all
The file name of the shell itself$1~ $n Each parameter value added to the shell. $ $ is the 1th parameter, and the $ = is the 2nd parameter ...$$ the shell itself PID (ProcessID)$! PID of the Shell's last running background process$? End code of the
(a) Ideas(1) Install the virtual user by Yum install vsftpd*-y(2) Shutting down the firewall and SELinuxService Iptables Stop Setenforce 0(3) Install the Virtual user authentication module(4) Create a virtual user's login name and password(5)
8.1:shell Introduction:The shell is a command interpreter that provides interaction between the user and the machine, supports specific syntax, supports logical judgments, loops, and each user can have his or her own shell:The CentOS default shell
Shell Introduction
The shell is a command interpreter that provides interaction between the user and the machine
Supports specific syntax, such as logical judgment, looping
Each user can have their own specific shell
CentOS7
Used to automate some of the front-end publishing operations.Script:# Webreleasepath is used to publish the directory, Webrevisionpath is the development of the directory
1. Write a script to determine what the IP of the current online user is (there are many methods) in the 10.0.0.0/24 network.#!/bin/shfor N in ' seq 254 ' does ping-c1-w1 10.0.0. $n &>/dev/null If [$?-eq 0] then echo "10.0.0. $n is up
1. Export path= $PATH:/usr/local/mysqlPut the $path in front, or to add to the path inside of the way to write the wrong words, you are tragic, processing is still more troublesome2. crontab inside Execute script remember Source/etc/profileCrontab
Recently learning shell programming, a little bit of gadgets to automate the collection of AWR reports, to facilitate problems in the system when troubleshooting.The contents of the script are as follows, the system collects the AWR report from 20 o'
The following scripts are based on the above log format, and if your log format is different, you need to adjust the parameters behind awk. in the analysis log UserAgentCat Access_20130704.log | Awk-f "\" "' {print $ (NF-3)} ' | Sort | uniq-c | Sort-
* * Define local variables, local variables will expire when exiting the shell client * ** * Single quote: Output AS-is * ** * Double quotes: If there are variables, the variables will be output * ** * No quotation marks: Output variable * *You can
Shell ScriptStandardize the general composition of shell scripts#! Environmental Statement (Sha-bang)# comment TextExecutable codeConsiderations for setting variablesIf the specified variable name already exists, it is equivalent to re-assigning a
1. First create a directoryVI hello.sh2. Write the first line of the shell#!/bin/bash (in order to declare a shell script, the first line must be written like this)3. You can add comments #the First program (this line of add # is not in effect)4.
Write a script to find the/data/log directory, the last created time is 3 days ago, the suffix is *.log file, packaged and sent to 192.168.1.2 Service under/data/log, and delete the original. log file, leaving only the packaged
1 "Judge input as number, character or otherScript code:Test results:2 "Averaging:Test results:3 "self-reducing output:Script code: Test results:4. Add a prefix to the file:Script code:Effect Display:5 "Batch test file is present:Script
2. Case statementOnly one conditional relationship is judgedGrammar:Case¢ variable name in"Value 1")Procedure 1;;"Value 2")Procedure 2;;*)Procedure 3;;Esac3. For loop1) Syntax: (Assigning a value to a variable executor, several values are executed
Writing ScriptsVI delbak.shThe code is as follows :#!/bin/shlocation= "/home/mysql/backup/"Find $location-mtime +7-type f |xargs rm-fexplanation :Location is the directory where the lookup is set--mtime +7 is set to 7 days ago (delete files from
Basic Regular expression:A regular expression differs from a wildcard character:A regular expression is used to match a string in a file that matches a condition, and a regular contains a match. grep, awk, sed, and other commands can support regular
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