Storing value from a parsed ping

后端 未结 4 980
孤城傲影
孤城傲影 2021-01-28 10:19

I\'m working on some code that performs a ping operation from python and extracts only the latency by using awk. This is currently what I have:

from os import sy         


        
4条回答
  •  悲&欢浪女
    2021-01-28 10:43

    Here is how I store output to a variable.

    test=$(ping -c 1 google.com | awk -F"=| " 'NR==2 {print $11}')
    echo "$test"
    34.9
    

提交回复
热议问题