-r FILE (conditional operator)

true if the file exists and is readable by you, i.e. the current user.

Examples

Different ways to test if a file is readable:
1
2
3
4
test -r ~/file && echo "readable"
[ -r ~/file ] && echo "readable"
# Bash
[[ -r ~/file ]] && echo "readable"
BashSupport Pro is a Bash IDE with support for -rtry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal