-R VAR (conditional operator)

true if the shell variable VAR is set and is a name.

-R is not included in POSIX.1-2017.

Examples

Different ways to test if a shell variable is set and is a name:
1
2
3
4
test -R var && echo "set"
[ -R var ] && echo "set"
# Bash
[[ -R var ]] && echo "set"
BashSupport Pro is a Bash IDE with support for -Rtry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal