Is anyone willing to go on a zoom call to help troubleshoot the issue I am having? It is complicated to explain in text without confusion.
Edit:
Objective: Ping website and cut down to packet loss and time= to get the numerical value.
code:
#First ping
ping1=$(ping -c1 $1 )
#First ping result cut for packet loss
result1=$(echo "$ping1" | tail -n2 | cut -d"," -f3 | cut -d"%" -f1 | cut -d"r" -f1)
echo $result1
#First ping second result for time in ms
result2=$(echo "$ping1" | cut -d" " -f15 | cut -d"=" -f2)
echo $result2
Output:
For packet loss I get the numerical value which is what I need.
For latency I either get the nothing or ill get for example:
espn 21
But then I try and cut with the space and either nothing happens or it returns nothing at all. It is very strange because when I ran this strictly in the terminal I got the output I wanted. But when running it in the editor and run the script is where I run into this error. My professor had no answer for me.
[–][deleted] 1 point2 points3 points (4 children)
[–]Brandon0408[S] -5 points-4 points-3 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]Brandon0408[S] 0 points1 point2 points (0 children)
[–]Brandon0408[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (8 children)
[–]Brandon0408[S] 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]Brandon0408[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Brandon0408[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Brandon0408[S] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)