Ignore:
Timestamp:
2018-12-07T18:17:09+13:00 (5 years ago)
Author:
ak19
Message:

On Kathy's machine, there is no eth0, as the default ethernet device has a different name, so doing ifconfig eth0 to get IPv4 address doesn't work. But on her machine, the older code that did just ifconfig to get the IPv4 does work, so using this method as a fallback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/bin/script/IPv4.sh

    r32463 r32664  
    1818# As below: if $tmp is empty, can just return |, as that doesn't really matter. Will be consistent with windows
    1919if [[ $tmp = *"Device not found"* ]] || [[ -z "${tmp// }" ]]; then
    20     echo "|"
     20    # eth0 is not found on Kathy's machine where the default ethernet device has a different name
     21    # But ifconfig on its own works there, so try that next
     22    tmp=`ifconfig 2>&1 | grep "inet " | grep -v 127.0.0.1`
     23    if [[ $tmp = *"Device not found"* ]] || [[ -z "${tmp// }" ]]; then
     24    echo "|"
     25    fi
    2126fi
    2227
Note: See TracChangeset for help on using the changeset viewer.