best shell scripting book

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

Using shell scripting to ping Check network connectivity between the blade server and the primary server

In order to check the network connection status between the daq01 and the blade server,1. Use the output rule of ping command, if can ping pass, will output 0% packet loss value; If you cannot ping the pass, the 0% packet loss is not output2. If the ping command output 0% packet loss successful execution, the network connection is OK, otherwise the network connection is not3. in Shell scripts | | For use, refer to 20360107Command1 Command2Indicates:

Getting Started with shell scripting--variables

content such as/boot is a specific content)$?: The state returned after the previous command was executed, when the return status value is 0 indicates normal execution, and a value other than 0 indicates an exception or errorDetermine if an error occurs correctly for 0 exception error for non 0 value between 1-127$: The currently executing process/program name (which is the name of the currently executing command or program)Tip: Add Environment variablesVim/etc/profileAt the end of the document

The SED of Shell scripting learning

file from line 22nd to line 33rd to the end of line 44th. Sed ' 1,21h;22h;23,33h;44g ' pass 18, move the file from line 22nd to line 33rd to the end of line 44th. Sed ' 22{h;d};23,33{h;d};44g ' pass 19, only the first word of each line is displayed. Sed-nr ' s/([^a-z]*) ([a-z]+) ([^a-z]+] (. *)/\2/p '/etc/passwd 20, print the first word and the third word of each line. Sed-nr ' s/([^a-z]*) ([a-z]+] ([^a-z]+) ([a-z]+] ([^a-z]+) ([a-z]+] (. *)/\2

Shell Scripting Encryption

Think of a long time not updated blog, today in the group to see the discussion about shell script encryption things.Think about it too, we are writing scripts sometimes configure the relevant account and password things, so as long as the permission can see the information, very insecure, there is no normal operation of the file encryption. The following two features are broadly available: Encrypt files to prevent others from seeing what I w

Shell scripting basics, using variables, conditional testing and selection, and list-looping

Http://classroom/pub/materials/userlist[Email protected]/]# vim/root/batchusers#!/bin/bashIf [$#-eq 0];then//$ #位置变量的数量, when no arguments are provided, the $ #为0, the expression is setEcho ' Usage:/root/batchusers ' >2//output Usage:/root/batchusers >2 into error outputExit 1//Return value 1, prompt for wrong input parameterselif [!-F $];thenEcho ' Input file not found ' >2Exit 2FiFor a in $ (cat $)DoUseradd-s/bin/false $aEcho $a created successfullyDone########################################

Automating code deployment through shell scripting

; shell_unlock;;; *) usage;esac}main$1$2Test mode [[email protected] ~]$ Curl--head http://192.168.56.11/index.htmlHTTP/1.1 Okdate:mon, 09:42:23 Gmtse rver:apache/2.4.6 (CentOS) openssl/1.0.1e-fips php/5.4.16 mod_wsgi/3.4 Python/2.7.5last-modified:mon, 2016 09:39: Gmtetag: "17-538ff61ca0a00" accept-ranges:bytescontent-length:23content-type:text/html; Charset=utf-8[[email protected] ~]$ curl-s--head http://192.168.56.11/index.html|grep "$ OK" http/1.1 OK3. Rollback1. List rollback version 2. The

Shell Scripting Learning Guide [third to fourth] find and replace, text processing tools

Summary: Chapter Three discusses the two basic operations that are commonly used when writing shell scripts. The fourth chapter introduces about 30 useful tools for processing text files.Chapter III Find and replaceSummary: This chapter discusses the two basic operations that are commonly used when writing shell scripts: text lookup, text substitution.3.1 Finding textTo remove a specific line of text from t

A set of Linux Shell scripting little Exercises

spaces. If IFS is null, the parameters is joined without intervening separators.oldifs= "$IFS" ifs= "" array= ($result) ifs= "$oldIFS" for I in ${array[@]}; Doecho $idone# Use Facter to get a set of Key-value# Facter output has a newline character, you must replace the newline character with a space# Replace newline characters with spaces to use awk or sed# awk-v rs= "" ' {gsub ("\ n", "");p rint} '# ECHO-E "2 \n1" | Sed ': A; n;$!ba;s/\n//g 'result=$ (facter | awk '/ipaddress/!/ipaddress_lo/{p

Shell Scripting Encryption

#shc是一个专业的加密shell脚本的工具. Its role is to convert the shell script into an executable binary file, which is a good solution to the script contains IP, password and so do not want to open the problem.HTTP://WWW.DATSI.FI.UPM.ES/~FROSAL/SOURCES/SHC's official websitewget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgzTAR-XF shc-3.8.9.tgzCD shc-3.8.9Mkdir-pv/usr/local/man/man1#这步是必须的, because SHC will ins

Linux Learning Notes-engineer technology: Shell Scripting Basics

script requires a user name list file as a parameter2) If no parameters are provided, this script should give a hintUsage:/root/batchusers, exit and return the corresponding value3) If a nonexistent file is provided, this script should give aShow Input file not found, exit and return the corresponding value4) New User login Shell is/bin/false, no need to set password5) User list test file:Http://classroom/pub/materials/userlist# wgethttp://classroom/

Bird Book Shell Learning Notes (i) Key concepts and commands in the shell

Statistics commands sort, WC, uniq Sortsort [-fbmnrtuk] [file or stdin]-F ignores case-B ignores the front space-m sort by month name-N using pure numeric sorting-R Reverse Sort-U The same data item appears only one item-T delimiter-K to sort by that intervalegcat/etc/passwd | Sort-t ': '-K 1//pair to: Sort the first column of the split WC statistic Word, line or character numberWC [-LWM]-L Number of rows-W Words-M character CountegCat/etc/profile | Wc-lwm Uniq duplicate data a

Shell Scripting Practices

Common shell scripting use cases, from the online reference and after the modification of the work, in addition to the wiki in the company to write records, it is necessary for a blog to record a drop.Combat Problem 1:Use the For loop to create a batch of 10 files in the/oldboy directory, with the name in turn:Oldboy-1Oldboy-2......Oldboy-10Answer:[[Email protected]]# cat 1.sh#!/bin/bashFor iin ' seq 1 10 '

Shell Scripting Learning Notes (3) Use of SED commands

{Command1Command2Command3}CommentsAs with the shell, the comment uses the #Replace[Address] S/pattern/replacement/flagsThis means that the part of the address line that matches the pattern is replaced with replacement.Of these, flags have several values:A number from N 1 to 512 that represents the substitution of the nth occurrence of the specified pattern in this mode.G makes a global change to all occurrences of the pattern space, and by default onl

Shell Scripting Learning

To see what versions of the Shell:cat/etc/shells system are currently running, the first process that starts is initHow bash Shell debugs:Simply add parameters after the SH command-N: Do not execute scripts, query the grammar within the scripts, if there are errors are listed!-V: The contents of scripts are displayed on the screen before executing the scripts;-x: The scripts content that will be used is displayed on the screen, slightly different from

Shell Scripting Learning

' test.in//Print line 3rd to 5th Sed–n '/hello/p ' test.in//print out lines containing hello Sed–n '/hello/= ' test.in//print out line numbers with Hello Sed–n '/hello/d ' test.in//delete the line containing Hello Sed Common editing commands The SED replace command uses the format "Address" s/old word/new word/"GPW" Address: If omitted, indicates that all rows are edited G: Global substitution, default means replacing only the first word to match P: Print the modified line W fname: Writes the

Shell scripting monitors memory and sends messages

1. Prepare the tool to send the message:#!/usr/bin/python#-*-Coding:utf-8-*-Import SysImport SmtplibImport Email.mime.multipartImport Email.mime.textServer = ' smtp.163.com 'Port = ' 25 ' def sendmail (server,port,user,pwd,msg): SMTP = Smtplib. SMTP () Smtp.connect (server,port) Smtp.login (user, pwd) Smtp.sendmail (msg[' from '], msg[' to '], msg.as_string ()) Smtp.quit () Print (' Mail sent successfully email has send out! ') if __name__ = = ' __main__ ':msg = Email.mime.mul

Shell Scripting Raiders (learning notes)--1.6 math and BC commands

requires the output on the screen to be "1+2+3+4+5+6+7+8+9+10= calculation results", which is a good example. [[emailprotected] tmp]# echo $ (seq -S " + " 10 " = ' seq -S " + " Ten | BC " 1 +2 +3 +4 +5 + 6 +7 +8 +9 +10 = 55 Echo $ (seq"+") =$ (('seq'+ "ten"))1+2+3+4+5+6 +7+8+9+Ten=[Email protected] tmp]#Echo$(seq-S"+" Ten)=$(seq-S" + " Ten|Xargs Expr) # Note"+"And" + "1+2+3+4+5+6+7+8+9+Ten= -Back to series article outline:http://www.cnblogs.com/f-ck-need-u/p/7048

Linux--shell Programming (vi) using scripting options and combination condition testing

Write a script:1. Add 10 users user1 to User10, password with user name, but only if the user does not exist to add;#!/bin/bash# forIinch{1..Ten}; Do if!IDUser$i >/dev/NULL; ThenUseradd user$iEcho "user$i"|passwd--stdin user$iElse Echo "User$i exists" fi DoneDelete the above 10 users#!/bin/bash# forIinch{1..Ten}; Do if IDUser$i >/dev/NULL; ThenUserdel-r user$i >/dev/nullEcho "user$i deleted" Else Echo "user$i NOT EXISTS" fi DoneExtension: Adds or deletes a specif

Shell scripting "creation, opening, display, stop, reset of KVM virtual machines under Linux"

Shell script Programming-case OneProgramming Requirements:1. Create a Vm-ctl script, under/bin/2. Implement features: Create a virtual machine, create a virtual machine snapshot, turn on a virtual machine, display a virtual machine, stop a virtual machine, reset a virtual machine.The script achieves the expected result:SH vm-ctl create|nodecreate|start|view|stop|reset VmnameThe implementation script is as follows:#!/bin/bashCase "$" inCreate) # #创建虚拟机

Shell Scripting Automated Collection

Remotely copy a file to the specified directory on the specified IP machine:./scp_file.sh/tmp/xx.sh/tmp/test/echo "Copy the file to the $ $ directory!" "For IP in 192.168.60.243 192.168.60.244 192.168.60.245 192.168.60.246 192.168.60.248do scp-r" [email protected] $IP: $ echo "SCP $ $ip is: $?"Doneecho "$? Distribution Complete!! "Remote execution of the specified shell file command on the specified IP machine (requires SSH support) (with parameters):

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