Shell-Judgment statement

The process controls the "if" expression if the condition is true then the following part is executed: if ...; Then....Elif ...; Then....Else....FiIn most cases, you can use test commands to test the condition.   For example, you can compare strings,

Shell Script Create Library

First create the name myfuns# My script functionsfunctionAddem {Echo$[ $1+ $2 ]}functionMultem {Echo$[ $1* $3 ]}functionDivem {if[ $2-ne0 ] Then Echo$[ $1/ $2 ] Else Echo-1 fi}Then create a script with the name: test14. SH #!/bin/bash#

Comparison of $@ and $* in the shell

[email protected] ceshi]# cat test.sh#!/bin/bash# test.shecho "-------------ISF is set to \"-seperator\ "------------"Ifs= "-seperator"; # Note that there is a minus sign (-) before SeperatorFor i in "[email protected]"; Do echo "@ ' $i '"; DoneFor

Linux Shell Test keyword

1) Judgment expressionIfTest (expression is true)IfTest! expression is FalseTest expression 1–a expression 22 expressions are trueTest expression 1–o Expression 22 expressions have a true2) Judging the stringTest–n string string is not zero in

A summary of---variables, comparisons, and tests used in shell programming

One, variableEnvironment variables, positional variables, pre-defined variables1. Environment VariablesEnv #查看环境变量2. Position variableVI location.sh#!/bin/bashsum= ' expr + $ 'echo "$ + $ = $SUM"./location #则12为第一个位置变了 $1,32 changed the second

Shell script checks Tomcat run state

path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/binexport  Java_home=/usr/java  export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar   export path= $PATH: $JAVA

Linux Shell Script Raiders (1.4)

1.4adding environment variables using functions1.4.1Introductionenvironment variables are typically used to store path lists, which are used to search for executables, library files, and so on. For example:$PATH,$ld_library_path, and they usually

Shell command-line statements

The first step:SSH Password-free login "with public key, private key"Step Two:#!/bin/bash while read server; Do "[email protected]" 2 >& 1 "s/^/$ Server:/" &donewait./bunsan2.sh Free Note: While read server considers the input as a

Shell Scripting Learning

1. CommentsIf you use bash, then in the script file header comment: #/bin/bash2, the script file with the Read and execute permissions, you can use the./shell.sh to execute, you can also use the SH shell.sh way to execute directly, SH is the soft

Shell Scripting Exercise 004

1.#!/bin/bashfor IP in 133 134 doname_8808= ' Nmap-p 8808,15080 172.16.1. $ip |sed-n "5" P|awk ' {print $} ' name_15080= '   Nmap-p 8808,15080 172.16.1. $ip |sed-n "6" P|awk ' {print $} ' if [$name _8808 = open-a $name _15080 = open] Then echo

The shell traverses the folder and executes the command

Background:There is a source package that contains many subdirectories and makefile, and the packed package is too large to be deleted and then packaged by all the binaries created by make.Demand:Therefore, make clean is required to clear all the

Shell Scripting Exercise 001

1. Practice Yourself#!/bin/basha=0while:d o a= ' expr $a + 1 ' if [$a-lt 4]then echo-n-E "input number 1 to 9 \ n" read Num case $Num in 1|2|3|4|5|6 |7|8|    9) Echo-e "You are number is: $Num!"   ;;    *) echo "R error number, game over!"  break;;

Shell Learning Note Five (special characters)

特殊字符 通配符 ?:匹配任意一单子符 *:匹配任意长度字符串 []:匹配其中任意一个字符,*、?在[]中是普通字符 引号 ""、‘‘ 注释符 # #!不是注释,但必须出现脚本的第一行 大括号 变量扩展 ${VAR} ${#STR} 通配符扩展 1、匹配多个排列组合的可能

Sorting algorithm Big Collection _ Insert Class--Hill (shell) sort

The feature of this series of blogs is--give the results of each orderOriginally wanted to write a good process, get a picture of what, but think online analysis too much, are better, so these blog even if it is a summary of their own it.#include

Use the shell to count the number of occurrences of a string and sort the display from large to small

Requirement Description: The string in the document is counted and sorted (from large to small), the test.txt content of the first 2 records is displayed as follows: A 12332a 2323a 234234b 232c 23432c 34 statistics and Sorting methods:

Array of shell scripts

#!/bin/bash#你必须知道的shell里面关于数组的操作. Arr= ("Hello" "word" "You" "is" "a" "Good" "Boy.")#arr = (' ls ') #我喜欢这个方法. Echo "-------for----------------" forIinch ${arr[@]} Do Echo $I DoneEcho "--------for---------------" for((i=0;i${#arr [@]}; i++)) {Echo

Realizing external network access to svn--peanut shell +visiualsvn in LAN to realize extranet access to SVN (iii) in LAN

After the first two articles, so far, we have acquired the external domain name and set up the SVN server, next, we will summarize how to implement access to the local area network.1. Install VISIUALSVN Server (visible: http://blog.csdn.net/lu930124/

Linux Shell variables and linuxshell Variables

Linux Shell variables and linuxshell Variables M @ meng :~ $ B = 2 + 3 m @ meng :~ $ Echo $ b2 + 3 However, the declare command can be used to set the type of a variable. Currently, only integer and array types are supported. Now, consider

Linux learning-advanced shell script programming (I) Functions and shell script Programming

Linux learning-advanced shell script programming (I) Functions and shell script Programming Citation:When writing shell scripts, you will find that the same code or functions are used in many places. It doesn't matter if it's a small piece of code.

Shell disrupt file lines

Shell disrupt file lines The idea is to generate a random array, and then output the row in the file according to the array elements. 1. It is very easy to generate a random array. It was a little difficult to start using it for the first time. The

Total Pages: 541 1 .... 524 525 526 527 528 .... 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.