shell scripting books

Want to know shell scripting books? we have a huge selection of shell scripting books information on alibabacloud.com

Shell Scripting Learning

program exit representative (typically 0 for execution success, not 0 for execution failure)echo $?--$# represents the number of arguments for the current shell--$* (an entire string) [email protected] (each parameter counts as a string) represents all parameters--$$ PID of the current processCustom variables--The syntax format is: Name=[value]--Note:Variable equals cannot have spaces on either sideVariable is case sensitive--Use ($ variable name) to

Configuration and optimization practices for the Shell Scripting development environment

information such as interpreter and author at the beginning of shell scriptAutocmd bufnewfile *.py,*.cc,*.SH, *.java exec": Call Settitle ()"func settitle ()ifExpand"%:e") =='SH'Call Setline (1,"#!/bin/bash") Call Setline (2,"#Author: Yang Yuanqiang") Call Setline (3,"#Blog1: http://aqiang.blog.51cto.com") Call Setline (4,"#Blog2: http://www.cnblogs.com/ivan-yang/") Call Setline (5,"#Time:". Strftime ("%F%T")) Call Setline (6,"#Name:". Expand ("%"))

The internal variables of shell scripting learning

        Ten$GLOBIGNORE A list of pattern matches for a file name, and if the file matched in the wildcard (globbing) contains a file in the list, the file will be removed from the matching result. $GROUPS This is a list of group IDs (arrays) for the current user, as is the content recorded in the /etc/passwd file. Eleven$HOME User's home directory     Twelve $HOSTNAME 

Shell scripting Exercises (12.11)

("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>Method Two: seq is a fixed notationIdea: 1. First define a variable i2. Let the value of sum first start with the value of 0,i from 1 to 1001.3. Let I equals a number to remove to 2 if equal to 0, is the number we want to let them add together can get the sum neededVim sum2.sh#/bin/bash#written by Lizheng#about sumLet sum=0For I in $ (seq 1 100); DoIf [$[$i%2] = = 0]; ThenLet sum+= $iFiDon

Shell Scripting Learning (iii)

Shell echo CommandDisplay Normal string:echo "I am cat_crazy."Note: The double quotes here can be omittedShow escape characters:If you want to output quotes, the * number needs to be escaped to output, as followsecho \ "I am cat_crazy\"The output is "I'm cat_crazy."Note: Quotes need to be escaped to outputDisplay variables:Name= "Cat_crazy"Echo $nameShow line breaks:Echo-e "Hello \ n" #-e open escape \ n line breakecho "Cat_crazy"The output is:HelloCa

Getting Started with Linux Shell scripting (ii) Looping statements

sundo Echo ' Today is $var 1 ' donefor var2 in {1..10..2}doecho ' this is $var 2 "Donefor Var3 in $ (SEQ 1 2) Doecho" I had a/an $var 3 "Donefor VAR4 in $ (LS) Doecho" Here's the file $var 4 "doneWhile loop#!/bin/bashi=1while ((I SELECT statementThis SELECT statement to the time the wood has seen, run when you can interact with the user, run the following program to understand. If you don't break it, you're going to die.#!/bin/bashecho "which color do you like?" Select Var1 in red Green Bluedoe

Shell scripting Knowledge (c) Regular expressions grep sed awk

.$: Contains the text content of the first field.awk ' {print $} ' filename prints the fifth column.Print permissions and file names for files in the current directory:awk ' {print $ ': ' $9} 'Total-rw-rw-r--.: BsdmakefileDrwxrwxr-x.:config-rw-rw-r--.: config.inDrwxrwxr-x.:d OCSDrwxrwxr-x.:feeds-rw-rw-r--.: Feeds.conf.defaultTo remove a sentence that contains a word in a file:Sed ' s/[^.] *mobile phone[^.] *\ . G ' filenameRemove the sentence that contains the word "mobile phone".The format of t

Shell Scripting Learning Notes (normal form)

Fgrep. These return values make it possible to perform aself-initiated text processing. I used the Egrep tool in the example above. is the extension of grep, a lot of other ways to use this tool and the above introductionSome of the inadequate places you can go to the encyclopedia to find out, in fact, some of the more advanced tools also support this expression. I'll be in the knot.The blog is again introduced.I personally think that the rote of these characters is inappropriate. We should le

8-shell Integer Expression introduction-Practice and enterprise case Scripting anatomy

Integer two-dollar comparison operator The comparer used in [] and test The comparer used in (()) and [[]] Description -eq = = or = Equal abbreviations, equal -ne != Not equal abbreviations, unequal -gt > Greater than greater than -ge >= Greater than or equal to greater equal -lt Less than than similar -le Less than or equal to

Shell Scripting 1

Tags: ret strong expr pts null. sh com bin filedetermine whether a variable is an integer through expr[email protected] scripts]# cat judge.sh#!/bin/bash############################################################### File Name:judge.sh# version:v1.0# Author:rain Jin# Blog site:http://www.cnblogs.com/rainjin/# Created Time:2017-10-27 21:19:42# Environment:centos 7.2 kernal 3.10.0###############################################################judging If the arguments you have entered is integers;If

Shell Scripting Learning notes-integer Two-dimensional comparison operator

Tags: Linux shell1.1 The following table is a common two-dimensional comparison operatorWe can also see through the man testTips(1) The "(2) the ">" symbol is greater than the meaning, if[["$a" > "$b"]], if[["$a" \> "$b"]. You need to escape in parentheses because the shell is also redirected with (3) The "=" symbol equals the meaning, if[["$a" = "$b"]],if[["$a" = "$b"]. Escaping is not required in single [].Special tips:"=" and "! = "use in [] does n

Shell Scripting Learning Notes-string test expressions

1.1 String test operatorThe string test operator has the function of comparing whether two strings are the same, whether the length of a string is zero, whether the string is null (NOTE: Bash distinguishes between 0-length strings and empty strings, etc.)The following table is a common string operatorYou can also view the string test operator with the man testString test operator Hints:(1)-N compares whether the string length is nonzero, or true if nonzero: [-n ' $myvar](2)-Z compares whether st

Shell Scripting-date comparison and judgment

Compare days with 2 dates1. Script referenceScript 1: #!/bin/bash#格式化过期日期,格式化过期日期完整时间以当前时间作为参考!expday="2018-04-11 `date +%T`"echo "Expire day is $expday"#当前日期时间格式为stamp时间戳todays=`date +%s`echo "Today is $(date +"%F %T")"#以下2种方式做时间的四则运算,分别使用 let 或者 $(( ))#过期日期已格式化,规避整数运算的误差(去余数)#let dayDiff=($(date -d "$expday" +%s)-$todays)/86400dayDiff=$(( ($(date -d "$expday" +%s)-$todays)/86400 ))echo "Diff day is $dayDiff days!"Other Notes:Bash does not support floating-point operations, and if floatin

The tenth chapter of the Linux command line and Shell scripting Encyclopedia uses the editor

Previous Edit CommandA: Append data after the current cursorO: The next line of the cursor inserts dataDW Delete a Wordd$ Delete to end of lineDD: Delete Row, 5dd delete 5 rowsThe use of backspace and delete keys in normal mode is not recognized.10.1.4 Copy and pasteDD can be pasted with p after deletion.The copy command is Y,YW copy a wordy$ Copy to end of lineThen use p to paste10.1.5 Find Replacement: s/old/new/g a line command to replace all old, which is replaced only on one line: N,ms/old

Shell scripting exercises for Linux

A. Triangle Square exercise1. Print triangles, method one, regular expressions650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/21/ea1ad50480c4e888094441dee06b962f.png "style=" float: none; "Title=" screenshot from 2017-11-21 21-34-44.png "alt=" Ea1ad50480c4e888094441dee06b962f.png "/>Method two, loop nestingI control lineJ Control Printing symbols650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/21/e08401143190fdb2eb60e1ef084e1528.png "style=" float: none; "Title=" screensho

"Linux command line and Shell Scripting Encyclopedia" chapter Fourth

fileYou can also connect many parameters.such as Sort-t ': '-K 3 testYou can think of it as something inside. xxx1:xxx2:xxx3:xxx4:xxx5means to sort the xxx3-T: Specifies a character to distinguish the key position-K:--key=pos1[pos1]. The sort starts with pos1, and if POS2 is specified, it ends at Pos2.| Redirects the output of the du command to the sort command.-r: Indicates descending order.Here is an example:4.3.21. grep [options] pattern [file]For example:grep t test//Search for text in test

Shell Scripting Exercise A

ifMulti-branch statement practice#!/bin/bashread-p " Please enter 100 m running seconds: "IIf [$i-lt] [$i-GT 0]Thenecho " Enter the final "read-p " enter male and female "aif [$a = male]Thenecho " into the men's group "elif [$a = female]Thenecho " Enter the women's group "Elseecho "Error"Fielif [$i-ge 10]; Thenecho " elimination "Elseecho " Error "Fi Case Statement Practice, automatically unzip the compressed file according to the filename suffixVim untar.sh#!/bin/bashCase $ in*.gz)If [-F $]Th

Shell Scripting Learning

(socket) and so on. [-R File] True if file exists and is readable [-s file] True if file exists and the size is not 0 [-T FD] True if the file descriptor FD is open and points to a terminal [-u file] True if file exists and set Suid (set UserID) [-W file] True if file exists and is writable [-x file] True if file exists and is executable [-O file] True if file exists and is a valid user ID [-G file] True if file exists and is a valid user group [-L file] True if file exists and is a symbolic co

Total Pages: 14 1 .... 10 11 12 13 14 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.