I would like to read an IP (variable) outside while.. loop to locate them.
The thing is to store result in "STORE_LOCATION" then call it after the loop:
STORE_LOCATION=''
echo -e "$SUS_IP" | "$AWK" '{ print $2 }' |\
while read -r IP
do
#echo "IP $IP"
STORE_LOCATION+=$( "$CURL" https://ipinfo.io/"$IP" )
done
echo "$STORE_LOCATION"
Expected result is:
{
"ip": "XXX.XXX.XXX.XXX",
"city": "Seattle",
"region": "Washington",
"country": "US",
"loc": "47,-11",
"org": "Inc.",
"postal": "889988",
"timezone": "America/Los_Angeles",
"readme": "https://ipinfo.io/missingauth"
}
{
"ip": "YYY.YYY.YYY.YYY",
"hostname": "HOST",
"city": "Roubaix",
"region": "Hauts-de-France",
"country": "FR",
"loc": "50,3",
"org": "SAS",
"postal": "59100",
"timezone": "Europe/Paris",
"readme": "https://ipinfo.io/missingauth"
}
Thanks in advance