PDA

View Full Version : Shell Scripts Help



fixxer37
28-07-2004, 06:07 AM
Hi All,

I'm in Akl, NZ. I took the TiVo plunge last Friday when I ordered a US box from eksys, I got it yesterday (it only took 3 days - record time!?).
I did this after reading all of the excellent info on the Oztivo and other sites.
Took most of yesterday to set up, but was rather painless as I have quite a bit of linux exp.
I have loaded oztivo image, followed all the info, went to nztivo.info, loaded NZ Sky channels, have it all running, recording BUT I can't run any of the sh scripts that I've downloaded or create. I have removed any ^M problems inherited from the downloads. It just says things like:
: command not found
filename: line 5: syntax error near unexpected token `else'

or unexpected end of file.
I have changed the #! /bin/sh bit around and tried bash, tivosh etc.
I get the above error when trying "sh filename" or else it just reports:
/hack/bin/filename: no such filename

Any ideas? I'm going to scrap the current set up and try again when I get my bigger HDD, and I'll do the correct timezone set up for Auckland etc via the nztivo site.

fixxer37
28-07-2004, 04:31 PM
BTW, this also happens with any script, sh, bash etc. I can't even run the Tytools server install script.

All other things work fine. also .tcl scripts work fine as well..

I have not read anywhere that anyone else has had this problem! And that worries me! :(

tenty
28-07-2004, 07:51 PM
I assume you have made sure that the files are executable?

Make sure you: chmod 755 filename
the scripts will not run otherwise. also I believe sh is symlinked into tivosh.

For those of you who do not know linux, symlinked means symbolically linked. ie. similar to a shortcut in windows. And chmod means "Change Mode". the reason 755 is used is because the numbers correspond to different modes. Short stop is that 755 will give you the permissions you require, however anyone wanting a lesson in how the numbers work, let me know and I'll post something.

fixxer37
29-07-2004, 07:45 AM
Yes, I can confirm that it is executable. (rwxr-xr-x)
I actually have a /bin/bash, and /bin/sh is symlinked to bash

Does tivosh support if then else stuff, because all the .tcl scripts work, but don't seem to be structured that way, otherwise I could convert some of the bash scripts to tivosh.

Anyhoo, thanks for the suggestion...

fixxer37
04-08-2004, 10:29 AM
I feel so dumb!

I didn't realise dos2unix was included with v3, I was running the scripts through it on my linux box before sending them over, but once the file was ftp'd - even linux to tivo the ^M appeared. I tried to remove them by hand but still had no luck!!

I guess I needed to be in binary mode for any other binary files sent too.
All the FAQs only mention the binary problem with scripts if sent from a Windows FTP Client -and I ignored this as I was going linux to linux.
I then fooled myself thinking I could just edit out all the ^M at the end of lines in scripts - but, no, this didn't work.
Thanks to dos2unix all scripts work fine now.

To Recap:

when in FTP type bin to change to binary before putting files on Tivo

type: dos2unix scriptname
to tidy it up.

I know all of this is in the FAQs at some point, but just in case...