The script test.sh content is as follows, execute the script under/home/myname/,Home directory with file a.txt,test.log,test.sh#!/bin/bashSql= "SELECT * from EMP;"Echo $sqlecho $sql > Test.logResults after execution:Select test.sh a.txt test.log
Self-taught shell, and was taught by the teacher, English class do not study English four how to live, haha, that there is no data on my attractiveness, ah, for love and dream!!!Recall the file format: filename with an. sh extensionFile content at
Bash is the default scripting language in a Linux system, and since it is a programming language, debugging of scripts is essential. Here's a simple debugging approach to bash:1 using Bash's parameter-X, such asBash-x a.sh+ for A in ' bafa{1..4} '+
Shell instance (i)
Example one:
equals-eq (equal)Unequal-ne (not equal)Greater than-GT (greater than)Smaller than-lt (less than)Greater than or equal to-ge (greater than or equal)Less than or equal to-le (lesser than or equal)Examples
Limit the number of rows when you sweep a table' table_name ' 5 }When the table is scanned, only five data is specified==============================================Delete TableThe deletion of the table requires the implementation of two steps,
What is a regular A regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. Or, the regular is the rule used to describe a class of things.In Linux, wildcard characters are
Loop of shell scripts: repeating commands1.for CycleGrammar:For variable name in variable Value listDoCommandDoneFor based on the contents of the variable Value list, executes the command repeatedly until all the contents of the Variable Value
Umask Set permission mask
General default mask is 022
Directory highest permissions 777
File maximum permissions 666
Based on mask, permissions are
777-022 = 755
666-022 = 644
String test /p> test 1
Shell Basics (ii) Cut usageSyntax: cut-d ' delimited character ' [-CF] n-D after specifying delimiters , single quotation marks, must be a single character-f Specifies the paragraph, which can be separated by commas with multiple numbers-C is
String interception from the original address: http://www.jb51.net/article/56563.htmOne: string interceptionThere are VAR variables:var=http://www.aaa.com/123.htm1. # Intercept, delete the left character, leave the right character.echo ${var#*//}Www.
#! /bin/bash#The head can not be less, called the magic number, tell the computer is a shell script, with bash to execute it, otherwise unrecognized.Shell script file to end with. SH, not necessary, just good identification, specification.1.if
Reason:when It comes to insert sort,the snail Appears,as It just moves forward step by step or even worse. So we need some improvement.the first idea May is, we can walk forward in big strides. Shell sort do the same thing.The basic realization
Simple shell programming by Dreamboy1#!/bin/Bash2 while true3 Do4 Echo5 Clear6 Echo7Echo"System Maintenance Menu"8Echo"============================ "9Echo"1) Display the system date"TenEcho"2) Modify the system date" OneEcho"3) Show logged in user"
1: Give two files a record password, a record user, how to create a new user with Shell script?650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8E/65/wKioL1i_jr6RehB6AADkqMMaJhE915.png-wh_500x0-wm_ 3-wmp_4-s_328620466.png "style="
Method One: Switch to the directory where the shell script executes the shell script:cd/data/Shell. /hello.shThe./means to execute hello.sh under the current working directory. If you do not add./,bash may respond to an error message that could not
Parentheses Summary() Single parenthesis
Command group, the command in parentheses will open a new child shell execution
Variables in parentheses cannot be used by left script
Semicolon separated between commands
command-line editing operationsFunctionCtrl+b or LEFT ARROW keyMove one character to the left (move to the previous character)Ctrl+f or RIGHT ARROW keyMove one character to the right (move to the next character)CTRL + AMove to the beginning of the
Hill sort Shell Sort is an improvement based on the insertion sort, which is also divided into two parts,The first part, Hill sort IntroductionThe second part, how to choose the keyword, the key is to choose the key of hill sortFirst piece of hill
How to compile Bash execution(1) Bash test.sh(2) chmod 755 test.sh #给bash赋予可执行的权限 r-4 w-2 x-1./test.shBash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays. Similar to the C
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