Shell script learning-Why shell programming

Shell is a command interpreter. It is an insulation layer between the operating system kernel and the user. To be precise, it is alsoA powerful computer language. A shellProgramIt is called a script and is a very easy-to-use tool.Combine system

Replace Linux Shell Parameters

The $ symbol in Bash is used to replace the parameter name with the value represented by the parameter. For $, braces are optional, that is, $ A and $ {A} represent the same parameter. $ {} There are several expressions with colons: $

Shell script debugging-run log 2

Shell script debugging-run log 1   This article mainly describes how to output debug logs in shell scripts.   C/C ++ debug log In C/C ++, _ file __, _ FUNC __, _ line _ indicates which log of the current row comes fromSource codeWhich

Rotating the card shell-define the pair point)

Tangent to Vertex Returns a convex polygon.P, TangentLIsPIntersection andPInternalL. This concept is similar to orthogonal tangent. Pair of vertex points If two verticesPAndQ(BelongP) In the two parallel tangent lines, they form a pair of

Shell Summary of special variables: Location variables $1, $ *, $?

$1 indicates the first parameter. $ * indicates all parameters entered by the user. The hello1 script is as follows. A location parameter is acceptable. #! /Bin/bash Echo $1   Run the Script:./hello1 "Hello World" and output Hello World on the

Common ADB shell commands and database query methods in Android

The Common commands of ADB shell in Android and the methods for viewing application database information under cmd are as follows: CMD -- ADB shell: Enter the shell command interface of the simulator. Ls displays all the file directories in the

Shell (4) mongo.doc

1) Create FunctionName { ... } Or: Name (){ ... }   2) Call Use the function name directly. The function can be called only after it is defined; When a function has the same name, the new definition will overwrite the old definition and no

Shell Study Notes

Shell scripting is an interpreted language; The essence of shell scripts is an ordered set of shell commands; 1. Basic shell programming process 1) create a shell file 2) grant executable permissions to chmod A + x filename 3) execute the shell file.

Shell if else

Example: #! /Bin/sh Mypath = "/var/log/httpd /"Myfile = "/var/log/httpd/access. log" # Here, the-x parameter determines whether $ mypath exists and has executable permissions.If [! -X "$ mypath"]; thenMkdir "$ mypath"Fi # Here, the-D parameter

Write an awk script in the shell script to extract data. Note the format. Use shell variables in the awk, convert the numeric strings in the awk to numbers, and compare the strings in the awk.

In awk programming, do not forget that awk processes regular expressions. There are many internal functions, especially string processing functions. Calling these functions can reduce the workload. 1. Format // Note \ There cannot be spaces behind

Chapter 5 Study Notes of Linux Command Line and shell script Programming

Chapter 2: handling user input Command Line ParametersRead ParametersBASH Shell assigns some special variables called positional parameter to all the parameters entered by the command line.Even include the program name$0: Program name (Absolute

Chapter 5 Study Notes of Linux Command Line and shell script Programming

Chapter 2: using structured commands Use the if-then statement if commandthen commandsfi If the exit status code of the command after if is 0, execute then. Another Form if command; then commandsfi   If-then-else statement if commandthen

Sorting Algorithm-shell sorting

Shell sorting is a form of change in insert sorting. Because insert sorting compares each element and compares the current element with all the previous elements, in the worst case. Therefore, DL. shell proposed shell sorting in 1959, that is,

Common Linux Shell shortcuts

  Some terminal shortcut keys: CTRL + F Forward one character CTRL + B Move one character behind CTRL + E Move to end of line CTRL + L Clear Screen CTRL + d Delete current

Shell script entry notes

1. condition test Two formats: test condition or [condition] (Note that spaces are added on both sides)Condition can be a logical operation of multiple sub-conditions. The logical operator numbers include: -A logic and -O logic or ! Logic No &, | 2.

Use the Shell find command in detail.

 FindSearch for files or directories. Syntax: Find [directory...] [-Amin ] [-anewer ] [-atime ] [-Cmin ] [-cnewer ] [-ctime ] [-daystart] [-depyh] [-empty] [-exec ] [-false] [-FLS ] [-follow] [-fprint ] [-fprint0 ] [-fprintf ] [-fstype ] [-gid ]

Shell script used to detect Processes

Shell script used to detect Processes 10:38:08 | category: centos | font size subscription Script 1: #! /Bin/sh Program = XXXX # process name Sn = 'ps-Ef | grep $ program | grep-V grep | awk '{print $2} ''# obtain the process port numberIf ["$ {sn}"

Example of using the while loop in Shell

#! /Bin/sh # Filename: 2.sh B = 9 E = 15 Tmpb = $ B While [$ tmpb-Le $ E] Do Echo $ tmpb # Tmpb = 'expr $ tmpb + 1' // OK Tmpb = $ (expr $ tmpb + 1) Done After the script is executed, the output result is: 9101112131415   Note: The

How to judge whether a variable is empty in shell?

To determine whether the variables in a script are empty, I wrote a shell script like this: #! /Bin/sh # Filename: Test. Sh Para1 = If [! -N $ para1]; then Echo "is null" Else Echo "not null" Fi Then run the Script: test. sh uses

Linux system resource load is too high and Apache shell script is automatically restarted

Linux system resource load is too high and Apache shell script is automatically restarted   When we routinely maintain Apache Web servers in Linux, the endless loop caused by crawler crawling cannot jump out, or the collection of data from peers

Total Pages: 541 1 .... 446 447 448 449 450 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.