How can I assign a command to variable in a bash script? My script works like a charm when I start it
while true
        do
        echo "Building Local Tunnel"
        /opt/nodejs/lib/node_modules/localtunnel/bin/client --subdomain celero --port 8001 > /var/www/html/status
        sleep 2
        done
The problem is that I would like to know when my domain will be changed. So I can react on this.
Im trying to setup tunnel connection and assign the output into a variable. If the domain is changed I would like to save a new address to a file. My code doesn't work now. Could someone help me please?
#!/bin/bash
#sleep 6
dir=/home/pi/address.txt
while true
        do
        /opt/nodejs/lib/node_modules/localtunnel/bin/client --subdomain celero --port 8001 > $domain
        echo "${domain}"
        if [ "${domain}" != "${temp}" ]; then
                "${domain}" > "${dir}"
        fi
        $temp = $domain
        sleep 2
        done
 
    