checking presence of a file identified/ addressed by a variable
I am newbie in Linux shell scripting.Can anybody help me to check the presence of file identified by variable in Shell scripting?
For example: I am reading the content of a file using while command as below:
"while read -r line
done < file_name"
Now in this case every line in file gets stored in the variable 'line' one by one.Problem here is every line in the file is nothing but the file_path of another file say xyz.txt and I am checking presence of this xyz.txt file using below command:
if [-f $line]
as 'line' is the variable which stores file path of xyz.txt but it is not working. It is unable to check the presence of this xyz.txt file as i am addressing it with the variable 'line'.
Please help me.Thanks in advance.