I have tried with this one day but still i cant figure out why? echo is working fine but if is always return false.
#!/bin/sh -e
scan_fileExists(){
while read file; do
echo $file #echo is working
if [ -f $file ]; then
echo "Yes"
fi
done < $1
}
scan_fileExists "/home/myfile"
if [ -f "$file" ]; then... (Note the quotes..) Also, are you sure these files exist?