[root@localhost sh]# ./first.sh user01
用户正在创建
输入密码
[root@localhost sh]# id user01
uid=1002(user01) gid=1002(user01) groups=1002(user01)
[root@localhost sh]# cat first.sh
#!/bin/bash
echo '用户正在创建'
useradd $1 2> /root/sh/err.log
echo '输入密码'
echo $1 | passwd --stdin $1 &> /dev/null
[root@localhost sh]#
[root@localhost sh]# id lxfuser || useradd lxfuser
uid=1001(lxfuser) gid=1001(lxfuser) groups=1001(lxfuser)
[root@localhost sh]# id userlxf &> /dev/null && echo 1 || echo 2
2
[root@localhost sh]# id lxfuser &> /dev/null && echo 1 || echo 2
1
#统计文件数
[root@localhost sh]# find /etc -type f | wc -l
2627
统计当前监听的端口
[root@localhost sh]# netstat -apt | grep -c "LISTEN"
13
unset 变量名 #取消变量
[root@localhost sh]# echo $$
18519
[root@localhost sh]# echo $0
-bash
[root@localhost sh]# echo $?
0
[root@localhost sh]# echo $#
0
[root@localhost sh]# echo $*
[root@localhost sh]#
[root@localhost sh]# A=centos7
[root@localhost sh]# B='$A server'
[root@localhost sh]# C="$B"
[root@localhost sh]# echo $C
$A server
[root@localhost sh]# read -p "add user:" yourname
add user:lxf
[root@localhost sh]# echo $yourname
lxf
[root@localhost sh]# read -s -p "add user:" yourname
add user:
[root@localhost sh]#
#-s 不显示输入
打包目录
#!/bin/bash
read -p "请输入指定的备份目录:" SDIR
tar -zcpPf /root/sh/bk.tgz $SDIR
var=value #局部变量
export var=value #全局变量
export -n var #取消全局变量
#[]可以进行运算
[root@localhost sh]# X=50
[root@localhost sh]# echo $[++X]
51
[root@localhost sh]# echo $X
51
[root@localhost sh]# echo $[X++]
51
[root@localhost sh]# echo $X
52
[root@localhost sh]#
#expr 算术命令 BC 交互式计算
#生产随机数
[root@localhost sh]# echo $[RANDOM*RANDOM]
19148786
[root@localhost sh]# echo $[RANDOM%100]
11
#生成一组数
seq [OPTION]... FIRST INCREMENT LAST
[root@localhost sh]# seq 4
1
2
3
4
[root@localhost sh]# seq -s ' ' 4
1 2 3 4
[root@localhost sh]# seq -s ' ' -w 8 10
08 09 10
[root@localhost sh]# seq -s ' ' 8 10
8 9 10
[root@localhost sh]# seq -s ' ' -w 10 10 100
010 020 030 040 050 060 070 080 090 100
#${}替换字符
[root@localhost sh]# var1=111222333
[root@localhost sh]# echo ${var1/111/eee}
eee222333
[root@localhost sh]# echo ${var1/1/eee}#第一个1被替换
eee11222333
[root@localhost sh]# echo ${var1//1/eee}#所有1被替换
eeeeeeeee222333
#${}字符拼接
[root@localhost sh]# var1=server
[root@localhost sh]# echo $var1.6
server.6
[root@localhost sh]# echo $var12.6
.6
[root@localhost sh]# echo ${var1}2.6
server2.6
#tr 单字符替换
[root@localhost sh]# head -1 /etc/passwd | tr o O
rOOt:x:0:0:rOOt:/rOOt:/bin/bash
[root@localhost sh]# head -1 /etc/passwd | tr 'o' 'O'
rOOt:x:0:0:rOOt:/rOOt:/bin/bash
[root@localhost sh]# head -1 /etc/passwd | tr 'ab' 'AB'
root:x:0:0:root:/root:/Bin/BAsh
#shell识别目录
[root@localhost sh]# dirname "/root/sh/"
/root
[root@localhost sh]# basename "/root/sh/"
sh
#随机字符
[root@localhost sh]# uuidgen
499538cb-22ad-4b58-927a-ed5dca24614c
[root@localhost sh]# head -1 /dev/urandom | md5sum
ee1ba7e34a0db2b9e3d1559353629a6f -
[root@localhost sh]# head -1 /dev/urandom |md5sum
2b41823f6358648f2960b65ca3764f99 -
[root@localhost sh]# head -1 /dev/urandom
▒▒8▒ G▒▒▒▒Y\▒s▒v▒2d▒H▒▒▒▒▒gF˅▒0T▒q▒+U▒^T,▒}▒?$▒?㕒▒▒_▒>▒▒"▒O▒C▒A▒▒NP▒[▒ZIR▒▒;t▒B9▒9i▒▒▒z▒▒▒▒>dA밿1e▒▒vm▒▒▒KS=qkTb▒ߘrʍ▒▒N5l▒x▒
[root@localhost sh]# xterm-256color
bash: xterm-256color: command not found...
[root@localhost sh]#
[root@localhost sh]#
[root@localhost sh]# head -1 /dev/urandom | md5sum
ee1ba7e34a0db2b9e3d1559353629a6f -
[root@localhost sh]# head -1 /dev/urandom | md5sum | cut -c -16
fc08fb85d15d5439
[root@localhost sh]# head -1 /dev/urandom | md5sum | tr -d '-'
24b6d8821b196bc332e32822165985cd
[root@localhost sh]# head -1 /dev/urandom | md5sum | cut -c -8
ecb88340
[root@localhost sh]#
#命令替换
[root@localhost sh]# which tr
/usr/bin/tr
[root@localhost sh]# rpm -qf /user/bin/tr
error: file /user/bin/tr: No such file or directory
[root@localhost sh]# rpm -qf /usr/bin/tr
coreutils-8.22-24.el7_9.2.x86_64
[root@localhost sh]# rpm -qf `which tr`
coreutils-8.22-24.el7_9.2.x86_64
[root@localhost sh]#
[root@localhost sh]# test -d /root ; echo $?
0
[root@localhost sh]# test -d /ro1ot ; echo $?
1
[root@localhost sh]#
[root@localhost /]# test 1 -eq 1 ; echo $?
0
[root@localhost /]# test 1 -ne 1 ; echo $?
1
[root@localhost /]#
pgrep ''|wc -l # 查看进程数
#!/bin/bash
read -p "请输入分数(0-100):" FS
if [ $FS -ge 85 ]&&[ $FS -le 100 ] ; then
echo "$FS 分!优秀"
elif [ $FS -ge 70 ]&&[ $FS -le 84 ] ; then
echo "$FS 分!及格"
else
echo "$FS 分!不合格"
fi
===============================
[root@localhost sh]# ./first.sh
请输入分数(0-100):99
99 分!优秀
[root@localhost sh]# ./first.sh
请输入分数(0-100):76
76 分!及格
[root@localhost sh]# ./first.sh
请输入分数(0-100):40
40 分!不合格
[root@localhost sh]# ./for.sh
用户正在创建
Changing password for user user01.
passwd: all authentication tokens updated successfully.
Changing password for user user02.
passwd: all authentication tokens updated successfully.
Changing password for user user03.
passwd: all authentication tokens updated successfully.
[root@localhost sh]# cat userlist.txt
user01
user02
user03
[root@localhost sh]# cat for.sh
#!/bin/bash
echo '用户正在创建'
ULIST=$(cat /root/sh/userlist.txt)
for UNAME in $ULIST
do
useradd $UNAME
echo "1234456" | passwd --stdin $UNAME
done
[root@localhost sh]#
[root@localhost sh]# cat while.sh
#!/bin/bash
echo '用户正在创建'
i=4
while [ $i -le 50 ]
do
useradd user$i
echo "1234456" | passwd --stdin user$i &> /dev/null
let i++
done
[root@localhost sh]# function adder {
> echo $[$1+$2]
> }
[root@localhost sh]# adder 12 23
35
[root@localhost sh]#
root@localhost sh]# mkcd() {
> mkdir $1
> cd $1
> }
[root@localhost sh]# mkcd /root/sh/test
[root@localhost test]#
read -p "请输入一个字符:" KEY
case "$KEY" in
[a-z][A-Z])
echo "字母" ;;
[0-9])
echo "数字" ;;
*)
echo "特殊字符";;
esac
[root@localhost test]# cat -n /etc/init.d/myprog
1 #!/bin/bash
2 #chkconfig: 2345 10 95
3 #description:A test service script for myprog
4 case "$1" in
5 start)
6 echo "服务正在启动……"
7 sleep 86400 & ;;
8 stop)
9 echo "服务正在停止……"
10 pkill -9 sleep ;;
11 status)
12 pgrep -l sleep &> /dev/null && echo "运行中" || echo "未运行"
13 ;;
14 restart)
15 echo "服务正在重启……"
16 $0 stop
17 $0 start
18 ;;
19 *)
20 echo $"用法:$0 {start|stop|restart|status}"
21 exit 1
22 esac
[root@localhost test]#
[root@localhost test]# /etc/init.d/myprog
用法:/etc/init.d/myprog {start|stop|restart|status}
[root@localhost test]# /etc/init.d/myprog start
服务正在启动……
[root@localhost test]# /etc/init.d/myprog status
运行中
[root@localhost test]# /etc/init.d/myprog restart
服务正在重启……
服务正在停止……
服务正在启动……
[root@localhost test]# chkconfig --add myprog
[root@localhost test]# chkconfig --list myprog
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
myprog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost test]# ntsysv
[root@localhost test]#
[root@localhost sh]# cut -d: -f7 /etc/passwd > log.log
[root@localhost sh]# sort log.log | uniq -c
53 /bin/bash
1 /bin/sync
1 /sbin/halt
39 /sbin/nologin
1 /sbin/shutdown
[root@localhost sh]#
#内存最高的5个进程
[root@localhost sh]# ps aux | head -1 ; ps aux | sort -nr -k4 | head -5
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 17175 0.0 4.0 3410544 322596 ? Sl Mar18 8:11 /usr/bin/gnome-shell
root 17451 0.0 0.7 1306820 57324 ? Sl Mar18 0:30 /usr/bin/gnome-software --gapplication-service
root 16573 0.0 0.6 341228 51512 tty1 Ssl+ Mar18 0:06 /usr/bin/X :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-P0zIDq/database -seat seat0 vt1
root 3049 0.0 0.4 72588 33024 ? Ss Mar18 0:13 /usr/lib/systemd/systemd-journald
root 17499 0.0 0.3 594948 31632 ? Sl Mar18 0:01 /usr/libexec/tracker-store
#反序输出
[root@localhost sh]# tac first.sh
fi
echo "$FS 分!不合格"
else
echo "$FS 分!及格"
elif [ $FS -ge 70 ]&&[ $FS -le 84 ] ; then
echo "$FS 分!优秀"
if [ $FS -ge 85 ]&&[ $FS -le 100 ] ; then
read -p "请输入分数(0-100):" FS
#echo $1 | passwd --stdin $1 &> /dev/null
#echo '输入密码'
#useradd $1 2> /root/sh/err.log
#echo '用户正在创建'
#!/bin/bash
[root@localhost sh]# rev first.sh
hsab/nib/!#
'建创在正户用' ohce#
gol.rre/hs/toor/ >2 1$ ddaresu#
'码密入输' ohce#
llun/ved/ >& 1$ nidts-- dwssap | 1$ ohce#
SF ":)001-0(数分入输请" p- daer
neht ; ] 001 el- SF$ [&&] 58 eg- SF$ [ fi
"秀优!分 SF$" ohce
neht ; ] 48 el- SF$ [&&] 07 eg- SF$ [ file
"格及!分 SF$" ohce
esle
"格合不!分 SF$" ohce
if
[root@localhost sh]#
#window和linux 文件转换
[root@localhost sh]# yum -y install unix2dos dostunix
[root@localhost sh]# getconf ARG_MAX
2097152
#参数过多
[root@localhost sh]# head -1 /etc/passwd | xargs -d: -I{} echo {}
root
x
0
0
root
/root
/bin/bash
[root@localhost sh]#
[root@localhost sh]# head -10 /etc/passwd > pass.txt
[root@localhost sh]# cat pass.txt
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost sh]# egrep '^.oo' pass.txt
root:x:0:0:root:/root:/bin/bash
[root@localhost sh]# awk -F ":" '{print $1,$2}' /etc/passwd | head -n 10
root x
bin x
daemon x
adm x
lp x
sync x
shutdown x
halt x
mail x
operator x
[root@localhost sh]#
[root@localhost sh]# awk -F: '{print $1,$3}' pass.txt
root 0
bin 1
daemon 2
adm 3
lp 4
sync 5
shutdown 6
halt 7
mail 8
operator 11
[root@localhost sh]# awk -F: '{print $1","$3}' pass.txt
root,0
bin,1
daemon,2
adm,3
lp,4
sync,5
shutdown,6
halt,7
mail,8
operator,11
[root@localhost sh]#
[root@localhost sh]# awk -F: '$3==1||$3==7{print $1,$3}' pass.txt
bin 1
halt 7
[root]# seq 200 | awk 'BEGIN{i=0}($0%3==0)&&($0%13==0){i++;print}END{print i}' | cat -n
1 39
2 78
3 117
4 156
5 195
6 5
#200以内同时被13和3 正除数字的个数
[root@localhost sh]# seq 200 | awk -F: 'BEGIN{i=0;j=0}{if($3<=500){i++}else(j++)}END{print i,j}' /etc/passwd | cat -n
1 31 64
[root@localhost sh]#
[root@localhost sh]# cat -n /etc/inittab | sed -n '4,7p'
4 #
5 # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
6 #
7 # systemd uses 'targets' instead of runlevels. By default, there are two main
[root@localhost sh]#
10 operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost sh]# sed -n '4p' pass.log
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
[root@localhost sh]# sed -n '4,7p' pass.log
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync:x:5:0:sync:/sbin:/bin/sync
7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
[root@localhost sh]# sed -n '4p;7p' pass.log
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
[root@localhost sh]#
[root@localhost sh]# sed -i '1,2s/^/#/' pass.log
[root@localhost sh]# cat pass.log
# 1 root:x:0:0:root:/root:/bin/bash
# 2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
[root@localhost sh]#
[root@localhost sh]# sed -n '/root/w root.log' pass.log
[root@localhost sh]# cat root.log
1 root:x:0:0:root:/root:/bin/bash
10 operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost sh]#
[root@localhost sh]# sed '1,3H;$G' pass.log
1 root:x:0:0:root:/root:/bin/bash
2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync:x:5:0:sync:/sbin:/bin/sync
7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
8 halt:x:7:0:halt:/sbin:/sbin/halt
9 mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
10 operator:x:11:0:operator:/root:/sbin/nologin
1 root:x:0:0:root:/root:/bin/bash
2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
[root@localhost sh]#
[root@localhost sh]# sed '1h;2,3H;1,3d;$G' pass.log
4 adm:x:3:4:adm:/var/adm:/sbin/nologin
5 lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync:x:5:0:sync:/sbin:/bin/sync
7 shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
8 halt:x:7:0:halt:/sbin:/sbin/halt
9 mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
10 operator:x:11:0:operator:/root:/sbin/nologin
1 root:x:0:0:root:/root:/bin/bash
2 bin:x:1:1:bin:/bin:/sbin/nologin
3 daemon:x:2:2:daemon:/sbin:/sbin/nologin
[root@localhost sh]#
[root@localhost sh]# awk '!aa[$7]++{print $7}' /etc/passwd
to
[root@localhost sh]# awk -F: '!aa[$7]++{print $7}' /etc/passwd
/bin/bash
/sbin/nologin
/bin/sync
/sbin/shutdown
/sbin/halt
[root@localhost sh]# awk -F: '!aa[$7]++{print $1}' /etc/passwd
root
bin
sync
shutdown
halt
[root@localhost sh]#
cho 'test page' > /var/www/html/index.html #生成一个网页
elinks --dump http://127.0.0.1 #获取网页的文本连接
tail -n 10 -f /var/log/httpd/access_log #查看日志
[root@localhost sh]# awk '{ip[$1]++}END{for(i in ip){print i,ip[i]}}' /var/log/httpd/access_log | sort -nr -k2
10.232.101.137 39
172.16.238.5 11
127.0.0.1 2
[root@localhost sh]#
#脚本
#!/bin/bash
[ $# -le 0 ] && echo "用法:$0<Web日志路径>" && exit 1 #已加载的位置变量个数
echo '客户机 访问次数'
awk '{ip[$1]++}END{for(i in ip){print i,ip[i]}}' /var/log/httpd/access_log | sort -nr -k2
[root@localhost sh]# ./webtop.sh
用法:./webtop.sh<Web日志路径>
[root@localhost sh]# ./webtop.sh /var/log/httpd/access_log
客户机 访问次数
10.232.101.137 39
172.16.238.5 11
127.0.0.1 2
[root@localhost sh]#
[root@* conf.d]# echo 'abc.smvictest.com' | cut -d. -f1
abc
[root@* conf.d]# cat httpd-vhosts.conf
NameVirtualHost *
<VirtualHost * >
DocumentRoot /var/www/html/abc
ServerName abc.smvictest.com
CustomLog logs/abc.smvictest.com-access_log combined
ErrorLog logs/abc.smvictest.com-errot_log
</VirtualHost>
#脚本
#!/bin/bash
[ $# -le 0 ] && echo "用法:$0<虚拟主机域名>" && exit 1 #已加载的位置变量个数
FQDN="$1"
WEBROOT="/var/www/html/${FQDN%%.*}"
CONFIG="/etc/httpd/conf.d/httpd-vhosts.conf"
grep -q "ServerName.*$FQDN" $CONFIG && echo "此站点已存在" && exit 1
mkdir -p $WEBROOT
echo "$FQDN" > $WEBROOT/index.html
echo '<VirtualHost * >
DocumentRoot WEBROOT
ServerName FQDN
CustomLog logs/FQDN.smvictest.com-access_log combined
ErrorLog logs/FQDN.smvictest.com-errot_log
</VirtualHost>' >> $CONFIG
sed -i -e "s#WEBROOT#$WEBROOT#g" -e "s#FQDN#$FQDN#g" $CONFIG
service httpd reload
=========================================
[root@* conf.d]# cat httpd-vhosts.conf
NameVirtualHost *
<VirtualHost * >
DocumentRoot /var/www/html/abc
ServerName abc.smvictest.com
CustomLog logs/abc.smvictest.com-access_log combined
ErrorLog logs/abc.smvictest.com-errot_log
</VirtualHost>
<VirtualHost * >
DocumentRoot /var/www/html/aaa
ServerName aaa.smvictest.com
CustomLog logs/aaa.smvictest.com.smvictest.com-access_log combined
ErrorLog logs/aaa.smvictest.com.smvictest.com-errot_log
</VirtualHost>
[root@* conf.d]# cd /var/www/html/aaa
[root@* aaa]# cat index.html
aaa.smvictest.com
#!/bin/bash
[ $# -le 0 ] && echo "用法:$0<机构代号>" && exit 1 #已加载的位置变量个数
UP_USER=$1_upload
UP_PASS=$(uuidgen | cut -b -8)
DOWN_USER=$1_download
DOWN_PASS=$(uuidgen | cut -b -8)
FTP_HOME="/ftproot'
USER_CONFIG_DIR="/etc/vsftpd/conf.d"
#创建上传账号
useradd -d $FTP_HOME/$UP_USER $UP_USER
echo $UP_PASS | passwd --stdin $UP_USER
#创建下载账号
chmod 755 $FTP_HOME/$UP_USER
useradd -d $FTP_HOME/$UP_USER $DOWN_SER
echo $DOWN_PASS | passwd --stdin $DOWN_USER
#建立账号配置
echo "download_enable=NO" > $USER_CONFIG_DIR/$UP_USER
echo "write_enable=NO" > $USER_CONFIG_DIR/$DOWN_USER
#建立账号记录文件
echo "FTP Accounts of $1
Upload User:$UP_USER
Password:$UP_PASS
Download User:$DOWN_USER
Password:$DOWN_PASS" > /root/$1_ftpac.tXt
[root@* sh]# ll /ftproot/
total 0
drwxr-xr-x. 3 gdsmvic_upload gdsmvic_upload 78 Apr 3 23:05 gdsmvic_upload
drwxr-xr-x. 3 rgsmvic_upload rgsmvic_upload 78 Apr 3 23:05 rgsmvic_upload
[root@* sh]#
[root@* sh]# ll /etc/vsftpd/conf.d/
total 24
-rw-r--r--. 1 root root 16 Apr 3 23:08 gdsmvic_download
-rw-r--r--. 1 root root 19 Apr 3 23:08 gdsmvic_upload
-rw-r--r--. 1 root root 16 Apr 3 23:08 rgsmvic_download
-rw-r--r--. 1 root root 19 Apr 3 23:08 rgsmvic_upload
-rw-r--r--. 1 root root 16 Apr 3 22:39 smvic_download
-rw-r--r--. 1 root root 19 Apr 3 22:39 smvic_upload
[root@* sh]#
#/bin/bash
echo -n "红球:" ; sleep 1
i=1
while [ $i -le 6 ]
do
red=$[$RANDOM%33+1]
echo $redstring | grep -qw $red && continue
echo -n " $red"
redstring="$redstring $red"
sleep 1
let i++
done
echo
echo -n "蓝球:" ; sleep 1
echo " $[$RANDOM%16+1]"
#/bin/bash
Price=$[$RANDOM%2000+1]
Times=0
echo "商品的实际价格为1~2000,猜猜看是多少?"
while true
do
read -p "请输入价格(0-2000):" FS
let Times++
if [ $FS -eq $Price ] ; then
echo "恭喜你答对,实际价格为$Price"
echo "恭喜你答对,一共猜测了$Times"
exit 0
elif [ $FS -ge $Price ] ; then
echo "太高了"
else
echo "太低了"
fi
done
[root@* sh]# cat urllist.txt
aaa.smvictest.com
abc.smvictest.com
qqq.smvictest.com
#!/bin/bash
TARGETS=$(cat /root/sh/urllist.txt)
PROBE=".feeler.html"
for i in $TARGETS
do
echo "##目标站点 $i"
echo -n " 端口状态"
nmap -sS $i -p 80 | awk '/80\/tcp/{print $2}'
echo -n " 业务系统运行状态:"
wget -q http://$i/$PROBE && echo ok || echo not ok
echo
done
[root@* sh]# ./chkweb.sh
##目标站点 aaa.smvictest.com
端口状态open
业务系统运行状态:ok
##目标站点 abc.smvictest.com
端口状态open
业务系统运行状态:not ok
##目标站点 qqq.smvictest.com
端口状态open
业务系统运行状态:not ok