Hi,
i am a novice in scrpting and need your help on the following. i have a script that checks if a file exists:
if [ -f $path/file1 ] ; then
echo " Files exists"
else
echo " file not found"
fi
assuming the files does not exist ,, the script when run dusplays " file not found".. so far true. but when i type : echo $? i get output as 0.
shouldnt it say 1 if a condition fails. if possible can someone plz explain why it shows 0 instead of 1 when a condition has failed.
thanks