Test File existence



[adimulamvenkat19851609@cxln4 ~]$ cat>hello.sh

#!/bin/bash
# Test File existence

echo "enter a filename"
read fileName

if [[ -f $fileName ]]
then
        echo "File exists"
        else
        echo "File does not exist"
fi


[adimulamvenkat19851609@cxln4 ~]$ sh hello.sh
enter a filename
filegrep.txt
File exists

[adimulamvenkat19851609@cxln4 ~]$ sh hello.sh
enter a filename
hello.sh
File exists

[adimulamvenkat19851609@cxln4 ~]$ sh hello.sh
enter a filename
prabhu.txt
File does not exist