Forrest logo
back to the [[ tool

warp:shell:file:exists:and:is:directory

Check if a file exists and is directory
$ [[ -d ${file} ]]
try on your machine

The command checks whether the value in the variable "file" is a directory (-d) or not. If it is a directory, the command returns a true value, otherwise, it returns false. The double square brackets "[[" are used for conditional expressions in Bash. The ${file} is used to fetch the value of the variable called "file".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the [[ tool