linux shell echo GUESS_IPV4_IF=$(ip route show | grep default | head -1 | sed -r 's/.+dev ([^ ]+echoGUESS_IPV4_IF=$(ip route show | grep default | head -1 | sed -r 's/.+dev ([^ ]+) .+/\1/')GUESS_PRIMARY_IPV4=$(ip addr show primary | grep "inet " | awk '{print $2}' | sed -r 's/\/[0-9]+$//' | tail -1)

问题描述:

linux shell echo GUESS_IPV4_IF=$(ip route show | grep default | head -1 | sed -r 's/.+dev ([^ ]+
echo
GUESS_IPV4_IF=$(ip route show | grep default | head -1 | sed -r 's/.+dev ([^ ]+) .+/\1/')
GUESS_PRIMARY_IPV4=$(ip addr show primary | grep "inet " | awk '{print $2}' | sed -r 's/\/[0-9]+$//' | tail -1)