您好,登录后才能下订单哦!
[root@master1-192-168-117-18 ~]# vim users.txt
[root@master1-192-168-117-18 ~]# vim Example.sh
#!/bin/bash
read -p "Enter The Users Password:" PASSWD
for UNAME in cat users.txt
do
id $UNAME &> /dev/null
if [ $? -eq 0 ]
then echo "Already exits"
else useradd $UNAME &> /dev/null
echo "$PASSWD" | passwd --stdin $UNAME &> /dev/null
if [ $? -eq 0 ]
then echo "$UNAME,create success!"
else echo "$UNAME,Create failure!"
fi
fi
done
[root@master1-192-168-117-18 ~]# bash Example.sh
Enter The Users Password:1234
zhangsan,create success!
lisi,create success!
wangmazi,create success!
hanmeimei,create success!
lilei,create success!
bobo,create success!
[root@master1-192-168-117-18 ~]# vim ChechHosts.sh
#!/bin/bash
HLIST=$(cat ~/ipadds.txt) #$(可执行命令)=·可执行命令·
for IP in $HLIST
do
ping -c 3 -i 0.2 -W $IP &> /dev/null
if [ $? -eq 0 ];then
echo"Host $IP is on-line."
else
echo"Host $IP is off-line."
fi
done
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。