You have asked two questions in one thread and not done much research before asking. That's not nice. You haven't done much work to help yourself so I don't feel like doing much work to help you.
Google is your friend. People here will be your friend too but only when you try and help yourself first.
You can find out about testing files in bash here