Using mtr in a bash script

r00igev@@r

Honorary Master
Joined
Dec 14, 2009
Messages
15,640
Reaction score
14,157
Location
Draadloos Bantha poo doo in 4ways
Are there some bash experts here?
I want to use mtr in a script with as follows:
mtr -rw -c20 -a 10.0.0.102 102.132.201.1
The address 10.0.0.120 I want to get automatically from the ip a command for interface eth1 as it is a dhcp address.
Any ideas?
 
Code:
mtr -rw -c20 -a `ip a show eth1  | awk '/inet /{print $2}' | cut -d/ -f1` 102.132.201.1
 
Top
Sign up to the MyBroadband newsletter
X