-a FILE (conditional operator)

true if the file exists.

Examples

Different ways to test if a file exists:
1
2
3
4
test -a ~/.bash_profile && echo "found"
[ -a ~/.bash_profile ] && echo "found"
# Bash
[[ -a ~/.bash_profile ]] && echo "found"
BashSupport Pro 是一个 支持 -a 的 Bash 集成开发工具 – 马上试用!
© 2020–2026 Joachim Ansorg
声明
隐私政策
许可条款