What command can be used to check if a directory does or does not exist, within a shell script?
Asked
Active
Viewed 2,682 times
1 Answers
1
if [ -d "/path/to/dir" ]
then
echo "Directory /path/to/dir exists."
else
echo "Error: Directory /path/to/dir does not exists."
fi

loki
- 387
- 2
- 8