With the below code, I keeping getting: line 9: [: 8.8.8.8: integer expression expected Unsure Why?
#!/bin/bash
sourceFile="file.log"
targetFile="2file.log"
ping="8.8.8.8"
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "$line" >> "$targetFile"
sudo service networking restart
ping -q -c 5 "$ping"
if [ "$ping" -ne 0 ]; then
sed -n -e 8p "$2file.log"
fi
done < "$sourceFile"