if [[ -d dir/ ]]; then ... fi

Category: Bash Scripting

if [[ -d dir/ ]]; then ... fi

Check if a path exists and is a directory

Checks if a path exists and is a directory. -d is the 'directory exists' test.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.