scripts/update/localip.sh

16 lines
398 B
Bash

#!/bin/bash
localip='/opt/wd/99-Temp/localip.txt'
> $localip
networks=('wlx90de80ca01ec' 'enp1s0' 'enp2s0')
for network in ${networks[@]}; do
ifconfig $network | grep -iq 'Device not found'
if [[ $? -ne 0 ]]; then
echo -n "$network: " >> $localip
ifconfig $network | grep 'inet ' | awk '{print $2}' >> $localip
echo >> $localip
fi
done
sed -i '/^$/d' $localip