Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a complete newbie and I'm starting to learn the basic for shell scripts. So I apologize if this question is very simple for most users. I'm trying to display the text TRUE to the screen if a file is tested to have the readable bit set using the if then statement.

Thank you most kindly,

share|improve this question
if [[ -r /path/to/your/file ]]; then
  echo "TRUE"
fi
share|improve this answer
    
Since -r is supported by [, you might as well use it to make it portable. (And the question doesn't state that they're using bash.) – Sparhawk Apr 7 at 11:02
    
@user1700494 do you think [[ would work ? – Rahul Apr 11 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.