Shell scripts automate interactive input by sending a \ n string or expect script

Writing a shell script inevitably encounters the steps that require interactive input instructions:Method One:# Cat Action.sh#!/bin/shRead-p "Enter Number:" No;Read-p "Enter Number:" Name;echo you have entered $no, $name;# sh action.shEnter

"Shell Programming" 2, syntax

First, declaring variablesMyurl= "http://see.xidian.edu.cn/cpp/linux/"mynum=100Attention:There can be no spaces between the variable name and the equals sign, which may be different from any programming language you are familiar with.At the same

Shell awk Command

Grammar:awk ' {command} ' filename multiple commands are separated by semicolons .awk ' begin {Command1} {Command2} End{command3} ' Note: Begin, END needs to be capitalizedCommon Variable Description:FS: Specifies the delimiter, which is the default

Hadoop 2.7.3 Shell

[Email protected] ~]$ HDFs dfs-helpUsage:hadoop fs [Generic options][-appendtofile ... ][-cat [-IGNORECRC] ...][-checksum ...][-CHGRP [-R] GROUP PATH ...][-chmod [-R] PATH ...][-chown [-R] [Owner][:[group]] PATH ...][-copyfromlocal [-f] [-P] [-l]

Shell automatically checks SSH brute-force IP and blocks attacks

#!/bin/bashlocal_ip= "192.168.0.4" #定义本地IP不会被拒绝tmp_log= ' Mktemp 'Cat/var/log/secure |grep "Failed password for root from" |awk ' {print $11} ' |uniq-c > $tmp _logCat $tmp _log |while Read lineDoAttack_num= ' echo $line |awk ' {print $} 'Attact_ip= '

Shell numerical calculation

The assignment and operation in the shell is the string processing by default, here are some special methods of mathematical operation in the shell, which can be seen later, hehe.1. Examples of error methodsAVar=1+1Echo $varThe result of the output

Shell Find command detailed

Find FilesFind./-type FFind a DirectoryFind./-type DFind a file or directory with the name testFind./-name TestLook for a file whose name matches the regular expression, and note the preceding '. * ' (found file with directory)Find./-regex.

Linux Shell Text Processing tool Highlights

This article describes the most common tools for using the shell to process text under Linux:Find, grep, Xargs, Sort, uniq, tr, cut, paste, WC, sed, awk;The examples and parameters provided are the most commonly used and most practical.I use the

Shell Regular Expression

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.There are regular things in life:For

JMeter Bean Shell Use (i)

First, what is the bean Shell BeanShell is a scripting language that conforms fully to the Java syntax specification and has its own syntax and methods. BeanShell is a loosely typed scripting language (this is similar to JS);

The 12th Chapter shell script Writing and common face question (i.)

Precautions1) Opening add interpreter: #!/bin/bash2) syntax indentation, use four spaces, and more explanatory notes.3) Naming recommendation rules: variable name capital, local variable lowercase, function name lowercase, the name reflects the

Server cluster Second Level file synchronization (Ssh+shell)

1. Introduction\2. The Business Server remotely updates the script to browse the server files#!/bin/bashoperate=$1IP=$2Conf_file="/var/www/html/test/ip_list"File_chsum="/var/www/html/test/cksvalue"File_ser="10.60.10.62"cksum () {SSH

Some good habits of shell scripting

Some good habits of shell scripting 1. Naming rules The script name ends with. SH, and names are as famous as possible. Here are a few of the script naming styles that are available for reference. Through the following fresh and

The role of various parentheses in the shell

the parentheses are the orders. curly braces are variable valuesOne, parenthesis, parentheses ()1 , single parenthesis ()① Command Group. The commands in parentheses will be executed in a new sub-shell sequence, so the variables in parentheses

Writing functions in the shell

Execute the "nano function.sh" command to create a new shell script file with the name "function.sh".650) this.width=650; "class=" Exp-image-default "alt=" How to write Function "src=" in shell scripts http://f.hiphotos.baidu.com/exp/w=500/ Sign=7148

Shell script-Used to check memcache and automatically restart the effective script

#!/bin/sh#check memcache process and restart if downmm_bin= "/usr/local/bin/memcached" mm_log= "/home/xxx/memcached_ Check.log "mm_ports= (" 11211 "" 11212 ") mm_param= ("-d-m 20480-p 11211-u www ""-d-m 256-p 11212-u www ") mm_count=${#mm_por

Shell Foundation--Numerical calculation of variables

Numerical Calculation of variables1.$ ((expression))(1). Experiment 1[Email protected] ~_~ day4]# cat test.sh#!/bin/bashA=6b=2echo "a-b=$ (($a-$b))"echo "a+b=$ (($a + $b))"echo "a*b=$ (($a * $b))"echo "a/b=$ (($a/$b))"echo "a%b=$ (($a% $b))"echo "a**

Shell Programming Basics

What is a shell script?Plain Text Document --the data stored in the document is stored in a character unit;a large number of command combinations to solve user problems according to user's needs;"Power of Execution"-the result of the multiple

JMeter Bean Shell Use (i)

Http://www.cnblogs.com/puresoul/p/4915350.htmlFirst, what is the bean Shell BeanShell is a scripting language that conforms fully to the Java syntax specification and has its own syntax and methods. BeanShell is a loosely typed

Use of shell arrays

Definition: array= (1 2 3)Echo ${array[0]}Echo ${array[1]}Echo ${array[2]}echo ${array[*]} all elementsEcho ${array[@]} The length of the arrayArray AssignmentArray= (1 2 3) There are 3 elements in this arrayArray[3]=4 4 elements in this

Total Pages: 541 1 .... 183 184 185 186 187 .... 541 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.