OK, firstly, that's my mistake, the gunzip -f XMLFILE.gz line should be:
gunzip -f $XMLFILE.gz
/home/hts/.xmltv path is the same as my /usr/bin path
No, what directory are you in when you log in? [the 'pwd' command will tell you if you don't know].
That's your home directory. You should put data files in a directory under there. Not in /usr/bin,
that's for programs.
For the purposes of stuff like this, the path you store in XMLTV isn't critical, other than
it must of course exist, so you could make it $HOME/junk [$HOME is where you end up when you log in],
or even /tmp [that's where I put mine]. The main thing is that you know where you're putting it so you can
tell the other stuff in your script where to find it.
Of course the script above won't work if you don't have socat. you can use nc, but you need the 'right' nc, only some versions
can write to a unix socket - what fun.
You're probably better off sticking with tv_grab_file - in which case you must store your file
where tv_grab_file is going to look for it. You can easily modify tv_grab_file to look in the right place.
So something like this should work.
XMLTV=/tmp
XMLFILE=$XMLTV/tv_grab_file.xmltv
wget -O $XMLFILE.gz '
http://au.freepg.tv/xmltv/oztivo/NSW.Sydney.gz?UID=<myid>&K=<mykey>'
gunzip -f $XMLFILE.gz
cat $XMLFILE