Can't execute tv_grab_file - syntax error
#1
Hello friends,
I'm having an issue with getting my EPG xmltv in to tvheadend.

I can't execute / run the tv_grab_file
I downloaded from here and modified the wget line to use the path to my xml file.

When executing it I get the following error:
Code:
/usr/bin/tv_grab_file1: line 5: syntax error near unexpected token `$'\r''
'usr/bin/tv_grab_file1: line 5: `if (( $# < 1 ))

Clearly I have very rusty (non-existant) *nix skills, but I'm usually pretty good at following instructions.
Any help would be greatly appreciated.
Reply
#2
I assume that, like the other tv_grab files, it should be executable in order to get it to appear in the tvheadend webmin console?

It's the only reason I can think of that it's not appearing for me in the list of grabbers.
Reply
#3
Check your line endings. File should be using LF not CRLF. If you've downloaded and edited in windows, its probably using CRLF
Reply
#4
(2020-09-30, 05:17)skatecadet Wrote: I downloaded from here and modified the wget line to use the path to my xml file.

When executing it I get the following error:
Code:
/usr/bin/tv_grab_file1: line 5: syntax error near unexpected token `$'\r''
'usr/bin/tv_grab_file1: line 5: `if (( $# < 1 ))
You may have downloaded it from there, but that's not the version you are using.  In the link you gave, the line in question is actually line 6 and it looks like this:
Code:
if [ $# = 0 ]

But it looks like you are using the same version I am, in which that same line really is line 5. For that one the first six lines look like this:
Code:
#!/bin/bash
dflag=
vflag=
cflag=
if (( $# < 1 ))
then

I got the one I am using from https://raw.githubusercontent.com/Rigolo..._grab_file so you may want to download it from there directly and make your path change - the two files are very similar but not exactly the same. Another thing, make sure the one you want Tvheadend to use is in the correct directory with all the other grabber files, on my system they are all in the /usr/bin directory, and of course the file has to be owned by root and executable.

But before you do any of this, make sure you have the Bash shell installed - at a command prompt type "which bash" (without the quotes) and hit enter, it should print a path such as /usr/bin/bash. If it doesn't then you don't have bash and that could be part of the problem. The version you linked to looks like maybe it's been modified to run on systems that only have the sh shell and not bash (specifically the line that's throwing the error has been changed), but as I say that's not the one you're running or you would not be getting that error message. Maybe you really did download that version and put it somewhere, but if so it's apparently not where Tvheadend wants to see it, and I suspect Tvheadend is using the one that specifies #!/bin/bash in the first line.
Reply
#5
(2020-09-30, 08:13)matthuisman Wrote: Check your line endings. File should be using LF not CRLF. If you've downloaded and edited in windows, its probably using CRLF

Bloody legend! You have no idea how happy you just made me.
Reply
#6
(2020-09-30, 10:05)oldtvwatcher Wrote: ...

Thanks so much for the considered reply.
Turns out that Matt was right - I had edited the file in windows before moving it across to the linux file space.
Reply

Logout Mark Read Team Forum Stats Members Help
Can't execute tv_grab_file - syntax error0