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

Choose login SSH using shell scripting custom implementation

Create two scripts in the system bin directory, respectively, Pssh tsshPssh#!/usr/bin/expect-fSet IP [lindex$argv 0]set Port [lindex$argv 1]set Password [lindex$argv 2]set TimeoutTenspawn ssh [email protected]$ip-P$portExpect {"*yes/no"{Send "yes\r"; Exp_continue}"*password:"{Send "$password \ r"}}interactTssh#!/bin/shEcho"here is a list of all your servers"Echo"1.A Server 192.168.100.11"Echo"2.B Server 192.168.100.12"Echo"3.C Server 192.168.100.13"Echo"0. Temporarily do not want to log in"Echo"

Shell scripting Exercises (12.12)

Write a script, create a folder, enter a folder, and then use the loop to create a sequential file in the folderIdea: 1. Create the specified folder and go to the folder2. Specify a variable with a value of 0 to allow this variable to be recycled3. Create one document at a time for Each loop until the end of the loopVim create.sh#!/bin/bash#written by Lizheng#about Create FileCD ~mkdir testfileCD testfilefor ((i=0; iTouch Testfile_$i.txtDone650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/

Shell scripting Exercises (12.8)

Enter 2 numbers (x, y) if x equals Y, the output is z=x+y, if x is greater than Y, the output is z=x-y, otherwise the output z=x+yVI number2.sh#!/bin/bash#written by Lizheng#about Panduanecho "Please enter the number"Read XRead Yif test $x-eq $yThen echo "z= $x-$y"Elif Test $x-gt $yThen echo "z= $x-$y"else echo "z= $x + $y"Fi650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8B/50/wKioL1hJd0rB2jlvAAALxj75lmM431.png-wh_500x0-wm_3 -wmp_4-s_3050974245.png "style=" Float:none; "title=" 333.p

Shell scripting Exercises (12.7)

Example 1. Enter any two numbers and make a judgmentVI number.sh#!/bin/bash#written by Lizhengecho "Please enter the number"Read aRead Bif test $a-eq $bThen echo "The No.2"Elif Test $a-gt $bThen echo "The > no.2"else echo "The Fi650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8B/40/wKioL1hIKCagQPMiAAAYfWCqQ_8745.png-wh_500x0-wm_3 -wmp_4-s_1863110480.png "title=" 555.png "alt=" Wkiol1hikcagqpmiaaayfwcqq_8745.png-wh_50 "/>Shell

Linux, Shell scripting Brute force user name and password

Because some registered user account rules can follow, and usually people's awareness of the poor, the password is relatively simple, the user name of the common password login test, to break the password.For learning purposes only, do not use for illegal use. The code has been partially modified, does not work properly, the test needs to modify the code according to the actual needs, in addition to the password security issues must be enough attention.Design ideas: Intercept HTTP packets

"Shell scripting Exercises" to determine user presence and user type

TopicWrite a script1. Pass a parameter to the script, this parameter is the user name;2. If the user exists, perform the following tasks* If the user's ID number is less than 500, display it as an administrator or system user;* Otherwise, display it as a normal user;3. If the user does not exist, add it;Answer#!/bin/bashUsername= $if["$username"=""]; Then Echo "Please input a username" Exit 1fiifId$username>/dev/null; Thenuserid=$ (id-u$username)if[$userid -lt -]; Then Echo "$usern

The grep command usage for Shell Scripting Learning notes

CTRL key[: Graph:] or [:p rint:] denotes ASCII 33-126 characters[: xdigit:] = 16 binary number [0-9a-f-a-f]Example:grep ^[[:upper:]] file finds lines beginning with uppercase letters in a line characterPOSIX characters need to be enclosed in [].6. Exact matchgrep "\Must have a quoted number7. Or character (extended regular expression character)Grep-e "Ou|se" matches rows with OUs or SE8.egrep and FgrepEgrep "Ou|se" fileEgrep "^-+b" file match begins with a "-" or "-" and a line containing B is

Shell Scripting Learning

Distance from the last write and a period of time, the period has been followed by private food learning, or did not develop a regular record of the habit, today to write the first script.After a few days of accumulation, learning the next shell script writing, the current master is not too mature, everything is certainly right from the beginning, write a simple bar (difficult will not write O (╯-╰) o).The way this script is executed is to enter the b

Shell Scripting Learning Notes-user input processing

: $*"(Note: e.g.--AB cannot be processed when the option is merged if the above operation can only handle a single option)2.3.4 getopt command, for option formatting, e.g:The colon after #!/bin/sh# B indicates that the B option has parameter set--' getopt ab:c ' [email protected] ' while [-N ' $ ']do case ' $ ' in-a ) echo ' Opt Ion a ";; -b) value= "$" echo "Option B, Value is $value" shift; -c) echo "Option C";; --) shift break ;; Esac Shiftdoneecho "T

Shell scripting learn to summarize the differences between--break and continue

Break is to jump out of the current loop, and continue is to jump out of the loop and start the new loop again[Email protected] test]#CatDemo.SH #/bin/Bash while true; DoRead-P"Please input number:"x yif((x>9)); ThenContinueelif((y>9)); Then BreakElseZ=$ ((x+y))Echo$zfi DoneEcho "Execution completed!"[email protected] test]#SHDemo.SHPlease input number:1 23Please input number:Ten 2 # $x >9, when the back part of the secondary loop is not executing, and the loop starts againPlease input number

Shell Scripting Learning Summary--variables and environment variables

行脚本参数的个数Echo '$*='$* #所有参数变成一个字符Echo '[Email protected]='[email protected] #所有参数basename$0 #获取文件名dirname$0 #获取文件的目录[email protected] sbin]#SH/usr/local/sbin/test.SHAA bb$0=/usr/local/sbin/test.SH$1=aa$#=2$*=AA Bb[email protected]=AA bbtest.SH/usr/local/sbinProcess state variables$? Gets the return value that executes the last command (0 is successful, others are failed)$$ getting the PID of the current shell$_ gets the last parameter of the previous c

"Shell Scripting Learning-2"

Tags:tty a regular expression devproject passwd regular penwho #!/bin/bash-#echo do what exetuate this project \nprintf "Please input your passwd" Stty-echoread Pass Shell Scripting Learning-2

Shell scripting Learn (2) compare two digit sizes

Tags: meaning cond centos7 test cat size pre BER syntax errorNote: The comparison string in the shell can only be used = =, Compare numbers using-eq,-ne,-gt,-ge,-lt,-le, or = =, [[Email protected]SH]$CatNumber_compare.SH #!/bin/bash# script Name: Number_compare.SH#用途: Compare two digit sizesEcho "Please input first number :"Read xEcho "You first number x= $x"Read-P"Please input second number:"yEcho "You second number y= $y"if[$x-eq $y]; Then Echo

Redhat Shell Scripting Exercises

file not found and then exit and return the corresponding value4. Created user login shell for/bin/false5. This script does not need to set a password for the user6. You can get the user name list as a test Http://rhgls from the URL below. Domain11.example.com/materials/userlistVim mkusers.sh#! /bin/bashIf [$#-eq 0];thenEcho ' Usage:/root/mkusers 'Exit 1Fiif [!-F $]; ThenEcho ' Input file not found 'Exit 2FiWhile Read lineDoUseradd-s/bin/false $lineD

To partition a hard disk using Shell scripting Automation

, This command keeps the command that is about to jump to another shell terminal to continue running in this terminal.The end of the logo is EOFThe two empty lines in the middle represent the carriage return, the default meaning.1 umount/dev/mmcblk1p1 2 /dev/ mmcblk1p13 umount/ dev/mmcblk1p2

Automating the deployment of DHCP services with Shell scripting, plus text-to-document verification

; "src=" Http://s3.51cto.com/wyfs02/M01/6D/71/wKioL1VkgxWDcoX1AAFFm2II9Jg092.jpg "title=" Iiii.png "alt=" Wkiol1vkgxwdcox1aaffm2ii9jg092.jpg "/>2 Restarting the DHCP serviceService DHCPD Restart650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6D/71/wKioL1Vkg-nSFvTyAACA2JR08T8552.jpg "title=" yy.png "alt=" Wkiol1vkg-nsfvtyaaca2jr08t8552.jpg "/>3 Authenticating the ClientService Network restart650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6D/75/wKiom1VkgtmwUhKTAAJ5iQ_rdLg175

Ubuntu uses shell scripting to copy a class of files from all directories in the current directory to the same directory

There are some files and directories under the current directory, each of which has several. txt files in each directory.It is now required to create a new directory in the current directory all, and all of those directories will have a. txt fileare copied to the directory all. The shell script in ubuntu12.04 is implemented as follows:#!/bin/sh# Hint Informationecho "Start:"# define VariablesDst=allPst=.txt# Copy files to destination folderIf [-D ${DS

About shell scripting when value too great for base (Error token is "08")

A problem was encountered today when writing a timed CP script, value too great for base (Error token is "08")The number system that originally started with 0 is recognized by default as an octal number, so my $datem-1 gets the month of the month in return: value too great for base (Error token is "08") This error, the solution isThe $datem format or the declaration is called decimal, ' 10# $datem '-1 so it can. That is, the variable or number that will be converted to decimal is preceded by a '

Shell Scripting compilation

-i ' $myline ' s/$/\a\nupstream fdfs_group1 {\ n server ' $tempvar ': 8080;/'/root/my/mybin/sbin/test.configSed ' 3a 123 ' 1.txtSed-i ' $myline ' a\nupstream fdfs_group1 {\ n server ' $tempvar ': 8080; '/root/my/mybin/sbin/test.configFive, the operation of the variableThe operation should be placed in square bracketsKnown variable myline, the variable plus 2 should be written as: $[myline+2]Vi. Replace the value of a string that appears several timesUnlimited:Sed-e ': a;/\ (. *abc\) \{3\}/{s/abc

Non-interactive scripting with Shell combined with expect

Simple needs to explain shell+expectInstall the Expect,yum installation firstYum Install Expect-y#!/bin/baship= ' 192.168.80.20 ' #定义远程交换服务器的IPpassword= ' [email protected] ' #定义输入的密码Expect Spawn ssh [email protected] $ip ls #在expect中执行命令Set Timeout-1 #定义超时时间, 1 is never timed outExpect "*:" #如果输出 *:Set Timeout-1Send "$password \ r" #自动输入passwordExpect EOF #结束EofThis article is from the "Eight Miles" blog, so be sure to keep this source http://5921271

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