How do you check if a file is in a directory shell?

Vy Bùi

New member
How do you check if a file is in a directory shell?
Answer
To check if a directory exists in a shell script and is a directory use the following syntax:
  1. [ -d “/path/to/dir” ] && echo “Directory /path/to/dir exists.” ## OR ## [ ! …
  2. [ -d “/path/to/dir” ] && [ !
 

Tìm kiếm

Back
Top