best bash scripting book

Discover best bash scripting book, include the articles, news, trends, analysis and practical advice about best bash scripting book on alibabacloud.com

bash scripting using "=" assignment, left and right cannot leave spaces

When assigning a value of "=" to a script variable, "=" cannot have spaces left or right, otherwise it will prompt an error.For example, the following examples: #!/bin/bashbegin_time = ' date +%h: %m:%s ". /a.outend_time = ' date +%h:%m:%s ' echo ' " echo " $BEGIN _time " echo " " echo " $END _time When the system time is assigned to Begin_time and Eng_time, in accordance with the previous habit, "=" Left and right to add a space, resulting in an error message:[email pro

Linux commands: Bash scripting-Script

'; DoIf ID $DUSER >/dev/null; ThenUserdel-r $DUSER[$DEBUG-eq 1] echo "Delete $DUSER finished."Else[$DEBUG-eq 1] echo "$DUSER not exists."FiDoneFiecho "$DEBUG add: $ADD del: $DEL"[Email protected] ~]#/adminuser33.sh-v--add tom2,tom3--del tom2ADD user Tom2 finished.ADD user Tom3 finished.Delete Tom2 finished.1 add:1 del:1Exercise: Write a script showlogged.sh , which is in the following format:Showlogged.sh-v-c-h|--helpamong them, - H option can only be used alone to display help information; -

Bash scripting seven Save the command output to a variable (reprint)

Transferred from: http://blog.csdn.net/csfreebird/article/details/7978699' symbol contains commands that can be saved to a variable after the command has been executed #!/bin/Bash v= ' java-version ' echo $v Execution Result: $./install.sh "1.6.0_34" 1.6. 0_34- B04) 20.9', English is Backtick, accent.There is another way to wrap the commands in $ (). #!/bin/Bash

Scripting of Bash functions under Linux (11)

Scripting of Bash functions under Linux (11)1. Function of script programming:Function: Structured programming, cannot run independently, needs to be executed when called, can be invoked multiple timesFormat 1:Function name {Statement...}Format 2:Function name () {Statement...}2. Call function Execution status return value:Format: return value, value between 0-2553. Use the function to complete the script t

Linux Bash scripting-command Chaining & Command lists

# this are to show what you are to execute a series of commands in one strike.$ clear; CD/; Ls-l; echo "You is in $PWD"; echo "Time to go home"; CD ~;# Use semi colon between command.# There is also command lists, which are for a different logic# # Double ampersand means anding, double pipe means ORING; When using if only when the first command exits 0 (successful), the later command would be proceeded; When using | |, if the first command exits none of zero (not successful), the later command

Linux Bash Scripting-command Substitution

'-back close or reverse closeShift +tilder? Command ExpansionCat > Lspath.txt/etc^cLs-l ' Cat lspath.txt ' | grep. conf > Etcconf.fileORLs-l $ (cat lspath.txt)Another example using "Du" command:Du-h ' Cat lspath.txt 'Set | grep EtcdirEtcdir= ' ls-l/etc 'Echo $ETCDIR # to reserve the normal format with use echo "$ETCDIR"Netstat-ant | grep 443# # # Checking HTTPS status, if result is 1, it is running; If result is 0, the HTTPS service is dead###Ssl_status= ' Netstat-ant | grep 443 | Wc-l 'Echo $ss

Bash Shell Scripting Learning (ii)

Write a second shell script today and write the after-class questions in "private cuisine". The problem needs to write a check whether a name exists, does not exist to create a file, there is a need to determine whether the name of the file, the file is deleted after the creation of a directory with the same name, if the directory is to delete this directory.First set up a basic condition: The Operation directory is/tmp/test/(note: If this directory does not exist you need to create manually), y

Linux command line and shell scripting---bash shell commands

contains the information and location of the source file. Referencing a hard-link file is equivalent to referencing a source fileCp-l test1 test4The-l parameter creates a hard-link test4 that points to the file test1.Note: You can only create hard links between files on the same storage media, and you cannot create hard links between files under different mount points.The parameter-s creates a symbolic link, or a soft connectionCp-s Test TEST5When copying a linked file, be aware that if you use

Linux Learning note--bash scripting one variable, variable type

Bash scripting one variable, variable typeShell Programming:Compilers, interpretersProgramming languages: Machine language, assembly language, advanced languagesStatic language: Compiled languageStrongly typed (variable) languageconvert into executable format in advanceC,C + +,JAVA,C #Dynamic Language: interpreted language On the fiy Weak typeEdge interpretation Side ExecutionASP,asp, PHP, Shell,Python,Pe

Puff---------Linux bash scripting---user interaction

51200083 linuxpartition1doesnotendoncylinderboundary./dev/sda2 64 128131024000008eLinuxLVM/dev/sda3 1281314118 1048981183Linux/dev/sda4 1411915665 12426277+5Extended/dev/sda5 141191542410490413+ NBSP;NBSP;82NBSP;NBSP;LINUXNBSP;SWAPNBSP;/NBSP;SOLARIS2, error path [[emailprotected]scripts]# ./test.shenteradiskNbsp;specialfile:hownosuchfile. [[emailprotected]scripts]#echo$?1[[emailprotected]scripts]#This article is from the "Reading" blog, make sure to keep this source http://sonlich.blog.51cto.co

Scripting for special usage of Bash programming loop statements under Linux (10)

Scripting for the special use of the while statement under the Linux Bash Program (10)1. Loop control:Break: Interrupts the entire loop statement, which is the statement following the execution of the script after exiting the loopContinue: Interrupt the current cycle, advance to the next round cycleExit: End Script Run2.while dead Loop, that is, when you do not know how many times the loopFormat: while:; Do

Linux Bash programming case statements and scripting (eight)

Linux Bash programming case statements and scripting (eight)1.case statement in the following format:Case variable inValue 1)Statement 1...;; Each branch statement ends with a semicolonValue 2)Statement 2...;;*) Other, equivalent if statement elseStatement 3...;;ESAC the entire case statement ends2 . Write a script that adds and deletes the user arbitrarily, with the following requirements:2.1: If the scrip

8.15_linux bash Shell scripting Getting Started (ii) and use of file lookup and compression

Bash shell scripting Getting Started (ii)Use of the Read commandRole:Use read to assign the input value to one or more shell variables:-p Specifies the prompt to display-T TIMEOUTRead reads the values from the standard input, assigns a variable to each word, and all the remaining words are assigned to the last variableEx.read-p "Enter a filename:" FILE650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M

Scripting for Bash programming until statements and formatted hard disk partitions in Linux (10)

Scripting for Bash programming until statements and formatted hard disk partitions in Linux (10)1. Summary of circular statement structure1.1.while Statement Enter the Loop statement when the condition is metWhile condition; DoStatementDone1.2.until Statement Enter the Loop statement when the condition is not satisfieduntil conditions; DoStatementDone1.3.for variable in list; DoLoop bodyDone1.4.for ((expres

Multiple SQL injection and cross-site scripting vulnerabilities in PHP Address Book

Multiple SQL injection and cross-site scripting vulnerabilities in PHP Address Book Release date:Updated on: Affected Systems:PHP Address BookDescription:Bugtraq id: 71862 PHP Address Book is a Web-based Address Book. PHP Address Book has multiple SQL injection and Cross-Sit

A practical Little book under Bash (not updated regularly)

1. lnoi.sh: Lists the number of connections per IP under the current system:# Cat Lnoi.sh#!/bin/bash# use for list connect numbers and IP address.netstat-n |grep ' ^tcp ' |Grep-v ' 127.0.0.1 ' |awk ' {print $} ' |Cut-d:-f1 |Sort |uniq-c |Sort-rn | awk ' begin{printf '%-10s%s\n "," Connum "," IP "}{printf"%-11s%s\n ", $1,$2} '2. lu.sh: List uid>=500 and!=65534 's account:# Cat Lu.sh#!/bin/bash# use for list

Total Pages: 2 1 2 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.