1

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.

2
if [[ -r /path/to/your/file ]]; then
  echo "TRUE"
fi
  • 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 '16 at 11:02
  • @user1700494 do you think [[ would work ? – Rahul Apr 11 '16 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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