samedi 11 janvier 2020

bash why is the if condition never met [closed]

I have written the following script to do an IP sweep:

#/bin/bash
if [ "$1" == "" ]
then 
echo "Wrong syntax" 
else
for ip in `seq 1 254`; do 
ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr ":" " " &
done 
fi

However, the if condition doesnt seem to be met when I enter the following

./pingsweep.sh

why is this? I have tried the suggestions on many other similarly asked questions to no avail.

Aucun commentaire:

Enregistrer un commentaire