check presence of input file

My script is taking a file "input.in" as input for running the script. My worry is that i need to execute the script only if the file is present, if it's not don't perform the next commands.

Just to have a check at the beginning of the script : If "input.in" exists, then go on. If it's does not exist exit.

if [ -f input.in ] ; then

  DO THE JOB

else

  exit

fi

Thank you, it's OK !

---------- Post updated 02-10-09 at 12:19 AM ---------- Previous update was 01-10-09 at 07:29 AM ----------

Hello again,

Now i need to test if the input file "input.in" exists and if it's NOT empty, then execute next commands. Else exit

Thanks in advance,

Hi

[ -s file ]

Read the man page for your shell. It tells you all you need to know.

Thank you !