1

What command can be used to check if a directory does or does not exist, within a shell script?

1
  • 2
    Next time, dear @ayyappa, have a look at the suggested older posts when you type your title ;-) Commented Feb 27, 2014 at 11:06

1 Answer 1

1
if [ -d "/path/to/dir" ]
then
      echo "Directory /path/to/dir exists."
else
      echo "Error: Directory /path/to/dir does not exists."
fi
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.