Dbcn= "mysql-h172.16.1.194-uroot-p123456";d b=dsp_ad_center;ii=0;ct= ' $DBCN-n-E "select COUNT (1) from Information_sch Ema. TABLES as t WHERE t.table_schema = ' $db ' and t.table_type = ' BASE TABLE '; "'; mkdir-p/chenenhui/$dbwhile true;doif
Environment variablesSome commandsVarious environment variables often appear in shell scripts, so to write a script, you must first understand the environment variables. Common commands for handling environment variables are listed below
Linux Auto-install JDK shell scriptA: This script runs the machine, LinuxB: The machine to install the JDK, LinuxFirst, on machine a where the script is running, you can log on to the machine B where the JDK is to be installed without SSH password,
A Linux basic commands1.1. CP commandThe function of this command is to copy the given file or directory to another file or directory, which is very powerful.Syntax: CP [option] source file or directory destination file or directory1.2. MV
echo Display in shell script with color display, echo display with color, need to use the parameter-e format as follows: Echo-e "\033[word background color; text color m string \033[0m" Example: Echo-e "\033[41;36m something Here \033[0m "where 41
The function of quotation marks1 double quotation marks ("")1) Use "" To reference any character or string except the character $ (dollar sign), ' (anti-quote), \ (backslash). Double quotation marks do not prevent the shell from special handling of
Shell script: Print 99 multiplication tableToday in three different ways to achieve the shell script Print 99 multiplication table, the code is as followsMethod 1: Use a For loop (a.sh)#!/bin/shfor i in {1,2,3,4,5,6,7,8,9}do to J in {1,2,3,4,5,6,7,8
A Tetris that was written on the web with a Linux shell script. It's the best shell I've ever seen written. Share a bit.The original author information is in the comments of the script.#!/bin/bash # Tetris game# 10.21.2003 xhchen #APP declarationAPP_
"Copyright notice: Reprint please keep Source: Blog.csdn.net/gentleliu. mail:shallnew at 163 dot com "There are many files in the Linux system, such as configuration files, log files, user files, and so on. The file contains a lot of information,
Format: "\033[display mode; front color; background color m string \033[0m"\033: Starting an escape sequence[: Start Color definitionThere are several ways to display the method:0 Terminal default settings1 高亮显示4 使用下划线5
1. FunctionsShell functions, which are used to customize a segment of a program. To simplify the code. Grammar:Funtion fname () { //do something}The shell is top-down, executed from the left and right. So the definition of the function needs to
CPU Information Acquisition
CPU UsageAcquisition algorithmCollect and calculate total CPU usage or single core utilization with/proc/stat files. Take cpu0 as an example, the algorithm is as follows:1. Cat/proc/stat | grep ' cpu0 ' gets cpu0 's
A function is a block of script code that is given a name and can be reused anywhere in the code. Whenever you need to use such a block of code in your script, simply reference the name of the function that the block is assigned to.Create a
In shell, the display format of commonly used date is as follows:
Date + % f // 2007-03-06Date + % Y % m % d // 20070306
Date + % t // 23:37:11
// YesterdayDate + % Y % m % d-d "-1 day"// TomorrowDate + % Y % m % d-d "+ 1 day"// Last monthDate + % Y
1. Delete the BOM and execute the following command under VI.
: Set nobomb
2. cause:
The so-called Bom is the byte order mark, which is a Unicode character that usually appears at the beginning of the text to identify the byte order
Shell supports custom variables. When defining a variable, the variable name does not contain a dollar sign ($), for example:
Copy text-only new window
Variablename = "value"
variableName="value"Note that there is no space between the variable
The day before yesterday, I briefly shared some opinions on using shell to write web crawlers. Today I specially sent the code and shared it with 51 bloggers. I still love technology, open source, and Linux.
For the annotation and overall conception
Use an automated shell script to find detailed thread information used by the CPU.
After some interceptor code is added to the project, the CPU alarm shows that the CPU usage exceeds 100%;
If you want to find out which code consumes too much
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