-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 是一个 支持 -R 的 Bash 集成开发工具 – 马上试用
© 2020–2026 Joachim Ansorg
声明
隐私政策
许可条款