A lot of content is easy to confuse, so it's better to sort out some concepts here.Shell is shell, meaning is a shell outside the operating system kernel, used to interact with the user, which is more commonly used on the server, so do not use the
Give you a full, you in the Linux environment to try to understand more:The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number
Getting Started with Shell programmingOne, variable assignment and arithmetic operationExample code:A=1echo $alet b= $a +1echo $bc =$[a+b]echo $cd =$[c*2]echo $dlet e=d*2echo $ef =$[e%5]echo $fNote the "=" number must not have spaces on either
Single Branch if statementif judgment condition; thenStatement1Statement1...FiTwo-branch if statement:if judgment condition; thenStatement1....ElseStatement2....FiMulti-Branched if statement:If judging condition 1;thenStatement1.....Elif Judging
First, the grammar for inch con1 con2 con3 ... Do # Perform content done for inch {min... Max} do # perform content done for (initial value; limit value; step order)) Do # Perform content done Second, practice
Input parameters for
Script First (test example 1) #vi first.sh
1
#!/bin/bash
2
echo ' your is in first file '
q) Call another script file in the current script file? Method One: Use sourceScript second (test
Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a glance using the SET command$*All parameter lists. such as "$*" in the
First, the grammarBreak: Used to jump out of a loop. Break N can jump out of a multilayer loopBreakBreak NContinue: Used to skip loops. Continue N can skip multi-layer loopsContinueContinue NIi. details and differences
Break forVar1inch 1 2 3 Do
The user log information needs to be counted, when the user behavior is analyzed, the shell can often easily take out a lot of data, and then put it in Excel.For example: The statistics log contains loadcustomprocess This address of access, by
The script implements a 2-per-scan monitoring of the process for the specified process name and restarts once the discovery process does not exist.#!/bin/sha=10;While [[@a-gt 5]]; Doif test $ (pgrep-f $1|wc-l)-eq 2;thenSH stop.shGnome-terminal-x SH
IamlaosongWe often use the Sqlplus EMSSXJK/EMSSXJK The SQL statement is equivalent to the input in the Sqlplus program environment, so that the input content is sandwiched between two eof, can be long and short, EOF can also be replaced by any other
Citation: Sometimes we meet this demand, we need to xxx.yyy the name xxx and extension yyy from the file name. These can be done using the "%", "percent", "#" and "# #" operators.A. "%" operator:1. Example:Example 1Example 22. Explanation:Example
Cited: Before all too lazy, not in time to learn the knowledge summarized into the blog. Recently learning shell programming is just the beginning of a habit of blogging. Usually we will encounter a problem, after writing a project, want to count
Use the shell to copy the files under the Windows environment to the usage below Linux.Under Linux, the DOS file format is converted to the use of the Linux file format, vi opens, then goes to the command format, executes, and then saves, which can
Related command files 1,runcommandinthreads.sh Multi-threaded implementation of the main code cdir=$ (dirname $BASH _source) # #Current directory of this script file.source $cdir/logutil.shfunction createfile ()
Linux monitors the running shell scripts of a process and linux monitors shell scripts.
This script scans and monitors the process with the specified process name at intervals of 2. Once the process does not exist, it restarts.
#! /Bin/sh
A =
Use shell commands to analyze statistics logs
When you need to collect user log information and analyze user behavior, you can use shell to conveniently retrieve a lot of data and place it in excel for statistics.
For example, for access with the
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.