Changeset 32463


Ignore:
Timestamp:
2018-09-17T17:46:52+12:00 (6 years ago)
Author:
ak19
Message:

Need to get machine's external IP address from eth0 device, not the first device that ifconfig returns

Location:
main/trunk/greenstone3/bin/script
Files:
2 edited

Legend:

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

    r31107 r32463  
    3939::set result=^|%result%
    4040
     41:: Echo a vertical bar up front, regardless of whether the result is empty
    4142echo ^|%result%
    4243goto fin
     
    4445
    4546:done
    46 :: Echo a vertical bar up front, regardless of whether the result is empty
    4747echo %result%
    4848
  • main/trunk/greenstone3/bin/script/IPv4.sh

    r30038 r32463  
    1313# But need to still replace the . with \.
    1414
    15 #echo `ifconfig | grep "inet " | grep -v 127.0.0.1`|cut -d' ' -f 2|cut -d':' -f 2
     15#echo `ifconfig eth0 | grep "inet " | grep -v 127.0.0.1`|cut -d' ' -f 2|cut -d':' -f 2
    1616
    17 tmp=`ifconfig | grep "inet " | grep -v 127.0.0.1`
     17tmp=`ifconfig eth0 2>&1 | grep "inet " | grep -v 127.0.0.1`
     18# As below: if $tmp is empty, can just return |, as that doesn't really matter. Will be consistent with windows
     19if [[ $tmp = *"Device not found"* ]] || [[ -z "${tmp// }" ]]; then
     20    echo "|"
     21fi
    1822
     23# grab just the portion of the line we want
    1924tmp=`echo $tmp|cut -d' ' -f 2|cut -d':' -f 2`
    2025
Note: See TracChangeset for help on using the changeset viewer.