LINUX ping statement parameter meaning

ping -c 3 -i 0.2 -W 3 $1 &> /dev/null
if [ $? -eq 0 ]

The meaning of each parameter in this statement is:
-c represents the number of pings (under Linux system, it will not stop after ping four times like Windows), and the following 3 means ping three times and terminates.
-i means the time interval between two ping visits, the 0.2 parameter means the interval 0.2s
-W means the defined waiting timeout time, 3 means more than three seconds, it is defined as ping failure.
$1 is the input The parameter
&> /dev/null means that the used parameters are automatically stored in a trash can without recycling function.
$? The parameter means that if the previous statement is executed successfully, it will return 0, if the execution is unsuccessful, it will Return non-zero data.
-eq is whether the former is equal to the latter.

Guess you like

Origin blog.csdn.net/weixin_41407439/article/details/90708115