Always i get “Source file not readable or exists, please check the file ” for the below code. I use cygwin in my windows machine to run the script. I am getting the same message even when the file is present in the location. How can i get more details as why the file is not readable.
#!/bin/ksh
#
# Scanning source file for existance and readable
file_loc="abc.xml"
if [ -f "$file_loc" -a -r "$file_loc"]
then
print "Source file read.\n"
else
print "Source file not readable or exists, please check the file $file_loc.\n"
fi
A space before the closing bracket is needed: