Hello,
I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below:
#/bin/bash
echo "Enter the IP address"
read ip
if [ ! -z $ip ]
then
ping -c 1 $ip
if [ $? -eq 0 ] ; then
echo "Machine is giving ping signal successfully"
else
echo "Machine is not giving ping signal unsuccessfully"
fi
else
echo "IP address is empty"
fi
- My question is what does the ! -z do and what is it called? Is it a string operator? I tried Google but to no avail. Any help would be much appreciated. Thanks in advance.