Linux bash script to extract IP address

前端 未结 13 2385
我在风中等你
我在风中等你 2020-12-04 15:44

I want to make big script on my Debian 7.3 ( something like translated and much more new user friendly enviroment ). I have a problem. I want to use only some of the informa

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 16:13

    A slight modification to one of the previous ip route ... solutions, which eliminates the need for a grep:

    ip route get 8.8.8.8 | sed -n 's|^.*src \(.*\)$|\1|gp'
    

提交回复
热议问题