hey all, quick question. I have this command:
MASK=0; echo "$(ifconfig en0 | awk '/netmask/ {split($4 ,a,"x"); print a[2]}')" | while read -n 1 bit && [[ "$bit" != "0" ]]; do MASK=$(($MASK + 4)); echo $MASK; done; echo $MASK
in the loop this will echo out 4,8,12,16,20,24 as desired but the last echo command outside of the loop echo's 0. Why doesn't $MASK retain what it was set to inside the loop?