Combing the basic knowledge of shell script & lt; + & gt;: Array
Array definition
Static definition: array= (1 2 3)
Dynamic definition: array= ($(ls))
Array assignment: array [3] = 4
Print array
Echo ${array [0]} print array elements with ${array name [subscript]} subscript starting at 0
Echo ${array []} subscript is or @ to get the contents of the entire array
Echo ${# array [@]} get the array length
Check whether multiple website addresses are normal in batch.
Requirements: shell array method implementation, detection strategy as far as possible to simulate user access ideas
Http://www.wewe.org
Http://www.tbibib.com
Http://werrfd.com
Http://192.168.0.7
Script
#! / bin/bash
[- f / etc/init.d/functions] & &. / etc/init.d/functions
Array= (
Http://www.wewe.org
Http://www.tbibib.com
Http://werrfd.com
Http://192.168.0.7
)
Wait () {
Echo-n "wait 3s"
For ((iThin0inction iUniverse devUniverse null)
RETVAL=$?
If [$RETVAL-eq 0]; then
Action "check $1" / bin/true
Else
Action "check $1" / bin/false
Fi
Return $RETVAL
}
Main () {wait
For ((iwait)
For ((iSuppli)