Check if file exist

Hi

Does anybody know how I can check if a file exists

i.e. see bellow, this doesn't work by the way and if tried countless variations on this

file1=$one/file111.txt
if [ -f $file1 ]
then
echo "Present"
else
echo "Not present"
fi

result :
Not present
(file is already present, eventhough its showing Not present....)

also have tried with -d & -z option not working....

Worked for me.

one="/home/myuser"
file1=$one/file1.txt
if [ -f $file1 ]
then
echo "Present"
else
echo "Not present"
fi
# sh test.sh
Not present
# touch /home/myuser/file1.txt
# sh test.sh
Present

EDIT: Oh my bad on a remote machine??? Are you using nfs to mount the directory? You will need to connect to the remove machine some how, nfs, samba, ssh, etc.....

below is my detailed issue about the query...

I have created two scripts, one with hardcoded and another one with extract from file instead of hardcoded,

script:1
--------
#!/bin/ksh
filename="$one/file1.dat"
if [ -f $filename ]
then
echo "$filename has arrived." >> $logfile
else
echo "$filename has NOT yet arrived." >> $logfile
fi
:>

Result:
$one/file1.dat has arrived.

script:2
--------
#!/bin/ksh
outfile=$HOME/outputfile.lst
splitfile=$HOME/splitfile.lst
infile=$HOME/inputfile.lst
rm -f $infile
rm -f $splitfile
rm -f $outfile
sqlplus -s << sqlEOF
$user/$pass
whenever sqlerror exit 1
set head off pages 0
set feedback off
spool $infile
SELECT files
FROM tab1;
spool off
sqlEOF
cat $infile | while read filename time
do
checkfile=$filename
echo $checkfile,$filename >> $splitfile
if [ -f $checkfile ]
then
echo "$checkfile has arrived." >> $logfile
else
echo "$checkfile has NOT yet arrived." >> $logfile
fi
done

Here after execute the script sh script2.sh

  1. $infile contains,
    $one/file1.dat 101010
    $one/file2.dat 110011
    $two/file1.lst 090909
    $two/file2.lst 110011

  2. splitfile shows,
    $one/file1.dat,$one/file1.dat
    $one/file2.dat,$one/file2.dat
    $two/file1.lst,$two/file1.lst
    $two/file2.lst,$two/file2.lst

  3. outfile shows,
    $one/file1.dat has NOT yet arrived.
    $one/file2.dat has NOT yet arrived.
    $two/file1.lst has NOT yet arrived.
    $two/file2.lst has NOT yet arrived.

Here those above files are presents in UNIX directory still it shows NOT yet received and the same is working for script 1 (hardcoded with one single file) and script 2 is NOT working.

Please help me...