Changeset 14 in lab for trunk/iptables/setnapt.sh


Ignore:
Timestamp:
Jul 6, 2009 2:49:54 PM (15 years ago)
Author:
mitty
Message:
  • FIX: use 'tr' to replace repeated SPACE with a single SPACE before 'cut' lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/iptables/setnapt.sh

    r10 r14  
    3131 
    3232if [ -z "${GATEWAYS}" ]; then 
    33     GATEWAYS=`/sbin/ip route show table main | grep -w default | cut -d ' ' -f 5` 
     33    GATEWAYS=`/sbin/ip route show table main | grep -w default | tr -s ' ' | cut -d ' ' -f 5` 
    3434fi 
    3535 
     
    4040    fi 
    4141     
    42     IPADDR=`/sbin/ip addr show dev ${GW} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1` 
     42    IPADDR=`/sbin/ip addr show dev ${GW} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1` 
    4343    if [ -z "${IPADDR}" ]; then 
    4444        # device doesn't seem to have an IP address 
Note: See TracChangeset for help on using the changeset viewer.