What am I doing wrong with this sample code?
for HOSTNAME in $(cat hostnames.txt)
do
file ="/path/$HOSTNAME.crt"
if [[-e "$file"]]
then
echo "file exist"
else
echo "file dose NOT Exist"
fi
done
ERROR:
=/path/ad.tc.crt: cannot open ‘=/path/ad.tc.crt’ (No such file or directory)
./certs_check.sh: line 15: [[-e: command not found
file dose NOT Exist
=/path/cpscom.ds.crt: cannot open `=/path/cpscom.ds.crt' (No such file or directory)
./certs_check.sh: line 15: [[-e: command not found
file dose NOT Exist
The first file /path/ad.tc.crt
exists so it should print "file does exist".