Answer the question
In order to leave comments, you need to log in
Write bash command value to variable?
Hello!
I'm trying to write the ip address of the network adapter into a variable and then insert the resulting ip address into a file, here's the script itself
#!/bin/bash
PATH=/etc/3proxy:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
echo -e "AT^RESET\r\n" >/dev/ttyUSB2
killall 3proxy
sleep 20
echo -en 'AT^NDISDUP=1,1,"internet.tele2.ru"\r\n' > /dev/ttyUSB2
#IP=`ip addr show wwp0s6u2i1 | grep -oP `inet \K\S[0-9.]+``
ip=$(ip addr show wwp0s6u2i1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
echo "" > /etc/3proxy/3proxy.cfg
cat > /etc/3proxy/3proxy.cfg << END
monitor /etc/3proxy/3proxy.cfg
daemon
timeouts 1 5 30 60 180 1800 15 60
maxconn 5000
nscache 65535
log /dev/null
flush
proxy -n -a -p8000 -i192.168.1.55 -e$ip
END
/usr/bin/3proxy /etc/3proxy/3proxy.cfg
ip addr show wwp0s6u2i1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1
monitor /etc/3proxy/3proxy.cfg
daemon
timeouts 1 5 30 60 180 1800 15 60
maxconn 5000
nscache 65535
log /dev/null
flush
proxy -n -a -p8000 -i192.168.1.55 -e(Тут должен быть ip из переменной)
Answer the question
In order to leave comments, you need to log in
echo -en 'AT^NDISDUP=1,1,"internet.tele2.ru"\r\n' > /dev/ttyUSB2
ip=$(ip addr show wwp0s6u2i1 ...
it already has time to be installed and the interface receives an ip-address?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question