Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I'm a beginner in shell scripting, but I've been asked to do some scripting for a job. I've been given some existing scripts to work with, but they are ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    5

    bash scripting - unexpected end of file error

    Hi,

    I'm a beginner in shell scripting, but I've been asked to do some scripting for a job. I've been given some existing scripts to work with, but they are all for tsch/csh and I'm using bash. When I run the scripts, I'm getting an "unexpected end of file error". I understand there are multiple reasons for this error, but I was wondering if there are any "common" reasons for this that I can go looking for. If anyone has any insight, it would be greatly appreciated!!

    Thanks,
    Ashley

  2. #2
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    Sometime this can be caused by an extra return at the end of a file. This can also be caused by formatting marks inserted by some text editors (Word).

    Make sure that you use a text editor like gedit, vi (vim), Nano or Emacs. There are others that you can use too.

    EDIT: Oh, and welcome to Linux Forums! (I almost forgot my manners)
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

  3. #3
    Just Joined!
    Join Date
    Aug 2009
    Posts
    76
    It may be a slight difference in the syntax of the scripts. Post one of them here and someone will be able to determine where the problem is.

    Other things you could try is to change the opening line to
    #!/bin/bash

    Or do a search in synaptic for tch or csh

  4. #4
    Just Joined!
    Join Date
    Sep 2009
    Posts
    5
    Thank you so much for responding. I figured out that a big problem was the if-syntax. Now I'm getting "bad substitution" errors for things like ${?TARGET_CPU}...I'm trying to figure out what that syntax would mean in csh and what the equivalent would be in bash, which seems like a simple enough task, although I'm having some trouble...If anyone has any suggestions I would be so grateful


    Thanks again!
    Ashley

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...