Welcome to the Linux Foundation Forum!

syntax error near unexpected token `fi'

#!/bin/bash
if [[ -e ${/fms2005/Sample/CronFlag.txt} [[ ; then
echo data file does exist
else
echo data file does not exist
fi


Error Msg:

Test.bsh: line 6: syntax error near unexpected token `fi'

Test.bsh: line 6: `fi'

what wrong with my script?

Im connecting to our Solaris Server through xShell...

thanks in advance...

Comments

  • mfillpot
    mfillpot Posts: 2,177
    You don't need the double brackets and you don't need the filename in a variant declaration. In addition you need to put the echo output in quotes.

    The corrected command is below.
    #!/bin/bash 
    if [ -e /fms2005/Sample/CronFlag.txt ] ; then 
        echo "data file does exist"
    else 
       echo "data file does not exist"
    fi
    
  • Thank you sir.. SOLVED!

Categories

Upcoming Training