Shell Script
Just do it, simply write a Shell script and it's done!
Script Name: Web site dead chain generation script
Script function: Daily analysis of the site the day before the Nginx log, and then extract the status code of 404 and UA for
1 Description of the phenomenonThe most recent batch execution command using SSH (with key trust already done), the script reads the list of hosts in the configuration file (the content is one host IP address per line), and then executes, but every
* Represents 0 or more arbitrary characters[[email protected] ~]# ls *txt11.txt 1.txt 22.txt 2.txt aa.txt a.txt? Represents only one arbitrary characterWhether it's a number or a letter, as long as it matches a single character.[email protected] ~]#
Method 1:while the most efficient and most commonly used method in the loop.While read line DoEcho $lineDone Note: This is done at the end of the file, as if it were done and then read the file in the same way.Method 2: Pipe method: Cat $FILENAME |
What is a q:1 shell script and is it required?A: A shell script is a text file that contains one or more commands. As a system administrator, we often need to use multiple commands to accomplish a task, and we can add all these commands in a text
Process Control of shell scripts
Process Control of shell scripts
Conditional statements
Conditional judgment
Loop Statement For,while,until
For loop
While loop
Until cycle
1, first use the sudo apt-get install dconf-editor command installation Dconf-editor, the default is not installed;2, after the installation is complete, run the Dconf-editor command to call out the window, press org->gnome->nautilus->preferences
Actual production caseThe production room self-built PPTP client is connected to the production room by dial-up, but once the client network is accidentally disconnected and then dialed againGenerates an IP conflict, so a script is written to
In the shell there will be a less common situation, that is, the script sometimes has a time-out phenomenon. Generally speaking, we will use the following script as a "timeout watchdog":#!/bin/bash./$1 & #这里设定后台运行的第一个参数pid = $!
The script reads as follows:-------------------------------------------------------------------------------------------------------#!/bin/sh#定义变量secs=3600Unit_time=60stepts=$ (($secs/$unit _time))echo CPU usage ...;For ((i=0;iDoPs-eo COMM,PCPU |
[Email protected] ~]# echo $PS 1 # View the main prompt ~]# echo $PS 2 # View from the prompt ~]# export ps1= ' [\[email protected]\h \w]\$ ' # Set the main prompt (temporary), If you want to permanently
Http://www.cnblogs.com/52linux/archive/2012/03/24/2415082.htmlScenario One: Modify environment variables for Linux serversWith Linux, there is a. bash_profile configuration file under the user root, which is only valid for the current user. Modify
Article Source: (Linux Shell) The first chapter--Small trial sledgehammer (next)1.6 Arrays and associative arrays1.6.1 Preparation KnowledgeBash supports common arrays and associative arrays at the same time. An ordinary array can use integers only
In the Hadoop, zookeeper, hbase, spark cluster environment has set up the environment, 工欲善其事 its prerequisite, now the device has been, the next is to open up, first from Spark-shell began to uncover spark artifact veil.Spark-shell is the command
This article explains the numerical calculation of variables in shell programming.1. Common Arithmetic operators:650) this.width=650; "Width=" "height=" 216 "title=" 2.png "style=" WIDTH:600PX;HEIGHT:216PX; "alt=" Wkiom1j4rnrydwfjaabg6obovmq759.png "
Job One: organize regular expression Blogs1, what is the regularA regular is a method of describing a character or string with a combination of special meanings (called regular expressions).Or, the regular is the rule used to describe a class of
Linux network configuration and SSH and Shell basicsFirst, the Linux network configuration The ifconfig command is used to configure and display network parameters for network interfaces in the Linux kernel. The NIC information configured with the
1.Shell IntroductionThe shell is a program written in C that is a bridge for users to use Linux. The shell is both a command language and a programming language. A Shell is an application that provides an interface through which users access 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.