Bash Script Error - Unexpected EOF Error

Forum rules
Before you post please read how to get help
crosenblum
Level 1
Level 1
Posts: 39
Joined: Fri Apr 06, 2012 10:53 am

Bash Script Error - Unexpected EOF Error

Postby crosenblum » Sun May 06, 2012 12:27 am

I am trying to create a script that downloads the latest xbmc4xbox build, extracts to temporary folder, then if my xbox ftp is up, make backups of key files, then uploads new version of xbmc to my networked xbox.

I am not finished working on it, but i like testing each function, to make sure everything works before going to the next step.

Perhaps one of you can see my error.

Code: Select all

#!/bin/bash
#xbmc updater
#by craig m. rosenblum

#setup variables
tmp=$HOME/xbmc_tmp
dld=$HOME/Downloads
latest=$dld/xbmc_latest.zip

#make sure temp folder exists
if [ ! -d "$tmp" ]; then
   mkdir $tmp;
if

#get the url of the latest stable release
url=http://www.sshcs.com;
filename=$(curl http://www.sshcs.com/xbmc/?mode=MU 2>&1 | sed 's/^.*<a href="//' | sed 's/".*$//' | grep '/xbmc/downloader*' | tail -1);

#combine both into full url
fullurl="$url$filename"

#download release
wget -O $dld/xbmc_latest.zip $fullurl

#verify that the file exists
if [ ! -f "$latest" ]; then
   exit
fi

#change to the tmp folder
cd "$tmp"

#unzip file to the tmp folder
unzip "$dld/xbmc_latest.zip"

User avatar
xenopeek
Level 23
Level 23
Posts: 19252
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Bash Script Error - Unexpected EOF Error

Postby xenopeek » Sun May 06, 2012 5:10 am

crosenblum wrote:#make sure temp folder exists
if [ ! -d "$tmp" ]; then
mkdir $tmp;
if

That last line should read "fi" instead. Also, perhaps not add semicolons to lines that don't need them. Confused me at least (this is not C :D).
Image

crosenblum
Level 1
Level 1
Posts: 39
Joined: Fri Apr 06, 2012 10:53 am

Re: Bash Script Error - Unexpected EOF Error

Postby crosenblum » Sun May 06, 2012 5:17 am

That fixed that problem lol.

Now I can't get the unzip to work correctly.

I download the zip file fine.

And if you manually unzip the file, it has all files in a root folder called BUILD, which I really don't want to have extracted, just the files/folders inside the BUILD folder.

Then i start to get these type of errors.


checkdir error: BUILD exists but is not directory
unable to process BUILD/system/scrapers/video/common/imdb.xml.


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 5 guests