Question: how to check if a directory exists in linux?
Answer: One can check if a directory exists in a Linux shell script using the following syntax: [ -d "/path/dir/" ] && echo "Directory /path/dir/ exists."
You can use ! to check if a directory does not exists on Unix: [ ! -d "/dir1/" ] && echo "Directory /dir1/ DOES NOT exists."