查看ip的时候想看什么就看什么
其实就是把ifconfig eth0命令写在脚本里面执行,并且在执行结果上截取想要的信息
要有这样的一个思想
ifconfig eth0只要ip
vim show_ip.sh
#!/bin/bash
ifconfig eth0 | grep '\<inet\>' | cut -d " " -f 10
echo the ip of eth0 is :`ifconfig eth0 | grep inet | cut -d " " -f 10 | head -n 1`
sh show_ip.sh