[add] get local ip, and write it to /opt/wd/99-Temp/localip.txt
This commit is contained in:
parent
3c1609aa68
commit
77a475b51e
15
update/localip.sh
Normal file
15
update/localip.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/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
|
||||
|
Loading…
x
Reference in New Issue
Block a user