Linux Shell Learning Notes

The first line of the shell script illustrates the path to the interpreter: #!/bin/bashRun the script two ways: Use the bash command to run the shell file, or grant the script file execution permissions, you can directly execute the fileWhen the

Shell Script 100 Example "II"

11. Scripting, man-machine Games#!/bin/bash#Author: The Adventures of Tintin (Jacob)Game= (Stone scissors cloth)NUM=$[RANDOM%3]computer=${game[$num]}#通过随机数获取计算机的出拳#出拳的可能性保存在一个数组中, game[0],game[1],game[2] are different possibilities in 3,

Shell Programming Basics

1. Execution style of the programProgram Programming Style:Past: Command-centric, data-serving instruction.Object type: Data-centric, instruction serves data.Program programming has the following characteristics:1) Sequential execution: refers to

Shell basic Syntax (ii)

If statementBasic formatFormat 1:if condition; Then statement; FiFormat 2:if condition; Then statement; else statement; FiFormat 3:if ...; Then ...; Elif ...; Then ...; else ...; Fican use && | | Combine multiple conditionsIf [$a-gt 5] && [$a-lt 10];

Shell Script--grep command for content lookup

The grep command retrieves the rows in the file that contain keywords (which can be used), and is case-sensitive by default.  Use the-c parameter to get the number of rows that contain the keywordUse the-n parameter to display the line number at the

A For loop statement for the shell under Linux

First Category: Digital cycle-----------------------------for1-1.sh#!/bin/bash for ((i=1; i; i++)); do Echo $ (expr31); Done -----------------------------for1-2.sh#!/bin/bash for with $ (seq1) do Echo $ (expr31); Done --------

Pipe character and job control/shell variable/environment variable configuration file

Pipe character and job controlPipe break: The result of the preceding command is passed to the following command by the pipe character.Example [Email protected] ~]# cat/etc/passwd|wc-l43 Job Control: When you run a process, you can use

Shell Exercises 20180117

There is a server as a Web application, there is a directory (/data/web/attachment) is not timed to be uploaded by users of new files, but do not know when to upload. So, we need to do it every 5 minutes to detect if a new file is generated. Please

Pipe character and job control shell variable environment variable configuration file

8.6 Pipe symbol and job controlThe effect of a pipe character is to drop the result preceding the symbol to the command following the symbol. Not all commands are available after the pipe character, and generally commands for document operations are

Shell Display with color font

Format: echo "/033[word background color; font color m string/033[control code"If you simply display the font color can be fixed control code bit 0m.Format: echo "/033[word background color; font Color m string/033[0m"Word background color range: 40-

Getting Started with Shell scripting

Shell Scriptdking~ sharing1.1 Scripting ConceptsPut multiple commands into a single file to facilitate one-time execution of a program fileUnified Script Storage Directory:/server/scriptsUsing Vim to edit scripts is recommendedTo view the script

Shell Script--File test

A file test is a test of whether a file or directory existsTest file format [operator directory or file] Note that there is a space between the opening parenthesis and the operator, and there is a space between the file or directory and the

Rapid deployment of network PXE shell scripts

#!/bin/bash#获取当前机器IP地址ip= ' Ifconfig | head-2 | Tail-1 | awk ' {print $} '#获取当前机器MASK地址mask= ' Ifconfig | head-2 | Tail-1 | awk ' {print $4} 'Mask1= ' echo $MASK | Awk-f. ' {print '} 'If [$MASK 1-ne 0];thenIp1= ' echo $IP | Awk-f. ' {print '} 'Min1=

Linux Shell Tutorials

Shell TutorialsShell is a C language program, he is a user using Linux bridge, Shell is both a command language, but also a programming language.The Shell refers to an application that provides an interface through which users access the operating

Shell Script Basics

Reprinted from Http://www.cnblogs.com/liyuhui-Z/p/7792108.htmlShell IntroductionAs a command language, the shell interprets and executes user-entered commands interactively, and as a programming language, it defines variables and parameters and

Getting Started with Linux fifth day--shell script Getting Started (bottom) debugging debug of Basic grammar

first, how to debug 1. Parameters through the SH command:SH [-NVX] Scripts. SH options and Parameters:-N: Do not execute script, query syntax only;-V: Before executing sccript, output the contents of scripts to the screen;-x: script to be used The

1211 Day after Class shell summary

1211shell High wavesArchive: Learning NotesDecember 11, 2017 13:10:56 Shortcut keys:Ctrl + 1 title 1Ctrl + 2 title 2Ctrl + 3 title 3Ctrl + 4 ExampleCtrl + 5 Program CodeCtrl + 6 Body Format Description:Blue

Shell beginner (ii) variables and arrays

Lite version:Definition: your_name=123 ps:= symbol can not have space around! Use: ${your_name}, you can use the variable alone without {}Read only: readonly your_name PS: not deleted after set to read-onlyDelete: unset your_nameQuotation marks:

Sorting algorithm--shell sorting

Second, the shell sortThe shell sort is also called "Reduced incremental Sort" (disminishing increment sort), based on the insertion sort.The shell suggested sequence is a common but not ideal increment sequence:1,...,n/8,n/4,n/2

One shell per day (ii) Log IP statistics sorting

Statistical analysis of log files in the number of accesses per IP and sorted from high to low?Download the file to a local suffix#!/bin/bashawk? ' {print?$1} '? ip.log?|? Sort?|? Uniq?-c?|? Sort?-rn?|? MoreSh-x uniqip.sh?+ awk ' {print $} ' Ip.log+

Total Pages: 541 1 .... 310 311 312 313 314 .... 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.