-e FILE (conditional operator)
true if the file exists.
It doesn’t matter if FILE refers to a directory, a file, or something else like a block
device.
This is the same as -a FILE.
Links
Examples
- Different ways to test if a file exists:
 1 2 3 4 5 6 7test -e /opt && echo "exists" test -e /opt/file.txt && echo "exists" [ -e /opt ] && echo "exists" [ -e /opt/file.text ] && echo "exists" # Bash [[ -e /opt ]] && echo "exists" [[ -e /opt/file.txt ]] && echo "exists"
BashSupport Pro 是一个 支持 -e 的 Bash 集成开发工具 – 马上试用!