centos7编写shell批处理文件和执行方法
生活随笔
收集整理的這篇文章主要介紹了
centos7编写shell批处理文件和执行方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
centos7編寫shell批處理文件和執行方法
cd /;
vi shownet.sh;
//shownet.sh批處理內容如下:
#!/bin/bash ping -c 4 www.qq.com; ping -c 4 192.168.10.99; ping -c 4 192.168.20.11; ping -c 4 192.168.10.24; echo 'good';執行shell批處理文件方法:
./shownet.sh
報如下錯誤處理方法:
cenos7.0 bash :permission denied
chmod 700 shownet.sh
然后再執行批處理
./shownet.sh
[root@test /]# ./shownet.sh PING www.qq.com (182.140.167.44) 56(84) bytes of data. 64 bytes from 182.140.167.44 (182.140.167.44): icmp_seq=1 ttl=128 time=7.27 ms 64 bytes from 182.140.167.44 (182.140.167.44): icmp_seq=2 ttl=128 time=4.38 ms 64 bytes from 182.140.167.44 (182.140.167.44): icmp_seq=3 ttl=128 time=5.95 ms 64 bytes from 182.140.167.44 (182.140.167.44): icmp_seq=4 ttl=128 time=5.89 ms--- www.qq.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 4017ms rtt min/avg/max/mdev = 4.383/5.877/7.274/1.027 ms PING 192.168.10.99 (192.168.10.99) 56(84) bytes of data. 64 bytes from 192.168.10.99: icmp_seq=1 ttl=128 time=1.44 ms 64 bytes from 192.168.10.99: icmp_seq=2 ttl=128 time=2.49 ms 64 bytes from 192.168.10.99: icmp_seq=3 ttl=128 time=1.22 ms 64 bytes from 192.168.10.99: icmp_seq=4 ttl=128 time=2.19 ms--- 192.168.10.99 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 1.229/1.840/2.493/0.521 ms PING 192.168.20.11 (192.168.20.11) 56(84) bytes of data. 64 bytes from 192.168.20.11: icmp_seq=1 ttl=128 time=2.61 ms 64 bytes from 192.168.20.11: icmp_seq=2 ttl=128 time=2.02 ms 64 bytes from 192.168.20.11: icmp_seq=3 ttl=128 time=1.76 ms 64 bytes from 192.168.20.11: icmp_seq=4 ttl=128 time=1.97 ms--- 192.168.20.11 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3006ms rtt min/avg/max/mdev = 1.762/2.092/2.611/0.318 ms PING 192.168.10.24 (192.168.10.24) 56(84) bytes of data. 64 bytes from 192.168.10.24: icmp_seq=1 ttl=128 time=1.62 ms 64 bytes from 192.168.10.24: icmp_seq=2 ttl=128 time=1.10 ms 64 bytes from 192.168.10.24: icmp_seq=3 ttl=128 time=1.02 ms 64 bytes from 192.168.10.24: icmp_seq=4 ttl=128 time=1.01 ms--- 192.168.10.24 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3006ms rtt min/avg/max/mdev = 1.010/1.191/1.626/0.256 ms good總結
以上是生活随笔為你收集整理的centos7编写shell批处理文件和执行方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 稳定性、鲁棒性、与非脆弱性的区别
- 下一篇: 认清电脑配件保修规定 不吃哑巴亏!