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

  • 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.
    1. #!/bin/bash
    2. if [ -e /fms2005/Sample/CronFlag.txt ] ; then
    3. echo "data file does exist"
    4. else
    5. echo "data file does not exist"
    6. fi
  • Thank you sir.. SOLVED!

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training