Linux.com

syntax error near unexpected token `fi'

Link to this post 08 Oct 10


#!/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...

Link to this post 08 Oct 10

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

Link to this post 12 Oct 10

Thank you sir.. SOLVED!

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board