Results 1 to 7 of 7

Thread: syntax error: unexpected end of file

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default syntax error: unexpected end of file

    Hello, Never scripted any shell. Attempted this, giving me error:
    line 14: syntax error: unexpected end of file

    Here is the code:

    #!/bin/bash
    FILELIST='ls /interface/cor360_iac/TASKJI/incoming/IAC*Export.txt'
    if [ -z "$FILELIST" ]
    then
    echo "error"
    else
    for FILE in 'echo $FILELIST'
    do DATAFILE='basename $FILE'
    sqlldr bolinf/***** control=$XBOL_TOP/bin/askcor360_inv.ctl data=$DATAFILE
    mv /interface/cor360_iac/TASKJI/incoming/$DATAFILE /interface/cor360_iac/TASKJI/archive
    echo $DATAFILE
    fi

    Appreciate your help.

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    406
    Thanks
    0
    Thanked 57 Times in 53 Posts
    Rep Power
    9

    Default

    Hi,

    for must end with done !
    like if ends with fi

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thank you for your quick reply,

    after adding the done in the script, I'm getting the following error:

    test.sh: line 12: syntax error near unexpected token `fi'
    test.sh: line 12: `fi'

    Here is the modified script:

    #!/bin/bash
    FILELIST='ls /interface/cor360_iac/TASKJI/incoming/IAC*Export.txt'
    if [ -z "$FILELIST" ]
    then
    echo "error"
    else
    for FILE in 'echo $FILELIST'
    do DATAFILE='basename $FILE'
    sqlldr bolinf/***** control=$XBOL_TOP/bin/askcor360_inv.ctl data=$DATAFILE
    mv /interface/cor360_iac/TASKJI/incoming/$DATAFILE /interface/cor360_iac/TASKJI/archive
    echo $DATAFILE
    fi
    done

  4. #4
    Senior Member
    Join Date
    Aug 2011
    Posts
    406
    Thanks
    0
    Thanked 57 Times in 53 Posts
    Rep Power
    9

    Default

    lol

    if ...
    for ...
    ...
    done
    fi

  5. #5
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Sorry for my ignorance ..I've modified the script and now getting another error:

    LRM-00112: multiple values not allowed for parameter 'data'
    SQL*Loader: Release 8.0.6.3.0 - Production on Mon Nov 28 16:55:09 2011
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    SQL*Loader-100: Syntax error on command-line
    mv: cannot stat `/interface/cor360_iac/TASKJI/incoming/basename': No such file or directory
    mv: cannot stat `$FILE': No such file or directory
    basename $FILE

    Thanks you for helping me out here.

  6. #6
    Senior Member
    Join Date
    Aug 2011
    Posts
    406
    Thanks
    0
    Thanked 57 Times in 53 Posts
    Rep Power
    9

    Default

    you should be using backticks, rather than single quotes, for example
    Code:
    varname=`someCommand`
    or latest command substitution
    Code:
    varname=$(someCommand)
    plus, use more quotes
    Code:
    sqlldr bolinf/***** control="$XBOL_TOP/bin/askcor360_inv.ctl" data="$DATAFILE"
    and uppercase variable names are for environmental variables.

    Please use codetags, it's the # button.

  7. #7
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    awesome!!
    worked like a charm.
    THANK YOU VERY MUCH for the help, much appreciated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 20th September 2011, 07:02 PM
  2. [Solved] .bash_profile error syntax error: unexpected end of file
    By shoboy in forum Shell scripting
    Replies: 7
    Last Post: 17th March 2011, 09:50 PM
  3. [Solved] Bash Script: unexpected end of file error
    By snowweb in forum Shell scripting
    Replies: 6
    Last Post: 21st April 2010, 02:09 PM
  4. error : unexpected inconsistency
    By chaitanyarhce in forum Linux software
    Replies: 1
    Last Post: 13th September 2006, 03:15 AM
  5. error : unexpected inconsistency
    By chaitanyarhce in forum Linux software
    Replies: 0
    Last Post: 12th September 2006, 05:48 PM

Tags for this Thread

Posting Permissions

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