获取网卡IP地址
#!/bin/bash
ifconfig eth0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1#!/bin/bash
theIPaddress=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)参考
Last updated