ubuntu ipconfig
sudo vi /sbin/ipconfig
Bash代碼
#! /bin/bash
for word in `ifconfig eth0 | grep "inet addr" | sed 's/ inet addr/addr/g'`; do echo $word | sed 's/:/\t/g'; done
route -n | awk '/UG/ {printf "gateway %-21s %s\n", $2,$8}' ;
grep nameserver /etc/resolv.conf ;
Shell代碼
sudo chmod +x /sbin/ipconfig
ipconfig