-d FILE (conditional operator)

true if the file is a directory.

Examples

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