Re: Executing Shell Scripts

"Taylor, ForrestX" <[email protected]> Wed, 12 Feb 2003 09:49:50 -0800
Newsgroups gmane.linux.redhat.release.guinness
Message-ID <[email protected]>
Robert Pare wrote:
> 
> I have a shell script that I obtained on line to setup ipchains.  I can
> execute this script on my production box ( I just tried to test it) but
> I can't run it on my text Linux box.  Every time the script tries to
> execute an IF statement, it returns "syntax error: unexpected end of
> file".  I am wondering if I am missing a package that interprets this
> kind of stuff or if there is something I should be including in my
> execute statement for this script.  Any help would be appreciated.

First of all, see if it has been touched by windows.  Open your script 
with vi `vi myscript`.  Before you touch any keys, take a look at the 
bottom line.  If it has the name of the file in quotes, and then [dos], 
the file has been touched by windows and must be repaired.  Run dos2unix 
on it `dos2unix myscript`.

If that is not the case, make sure that you have a 'fi' for every 'if'.

Forrest
--