查看ip

#!/bin/sh

ifconfig|grep "inet"|grep -o -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"|head -n 1

编程技巧