I ended up making this script on a DD-WRT router that is creating two unwanted files and I can't seem to understand why. I'm not a scripting genius, especially with bash, so any help would be appreciated.#!/bin/shsleep 30mkdir /tmp/myvpn; cd /tmp/myvpn# ... doing stuff...while [ 1 ]do  r1=`wget -q http://ipinfo.io/ip` > /dev/null  r2=`$(wget -q http://ipinfo.io/$r1/country)` > /dev/null  if [ $r2 -eq XX ]     then echo XX OK > /tmp/myvpn/result_check_vpn.txt    else        echo XX NOK > /tmp/myvpn/result_check_vpn.txt        killall -q openvpn        sleep 5        openvpn --config /tmp/openvpncl/openvpn.conf --route-up /tmp/myvpn/route-up.sh --down-pre /tmp/myvpn/route-down.sh --daemon        sleep 25        sh /proc/net/ip_conntrack_flush  fisleep 180doneThis script creates two unwanted files in /tmp/myvpn called country and ip. I must be doing something wrong.Basically the script tries to check if the VPN is established right by checking if I effectively changed country (it is necessary for me to perform this check).
Bash script creating unwanted files
shell script;wget
The files are being created by these two commands:r1=`wget -q http://ipinfo.io/ip` > /dev/nullr2=`$(wget -q http://ipinfo.io/$r1/country)` > /dev/nullOK, the second is a syntax error, but I asume that's a typo. The wget command's format is:wget http://www.example.com/fileIt will then download file and save it in the current directory. Since you haven't told us what you expected to happen, I will guess that you wanted to save the file contents in the variables. If so, you need to tell wget to print to standard output using -O -:r1=$(wget -qO - http://ipinfo.io/ip)r2=$(wget -qO - http://ipinfo.io/$r1/country) You can't redirect the output (> /dev/null) of course, since that means nothing is printed. 