What command can be used to check if a directory exists or not, within a Bash shell script?
Use the file
program.
Considering all directories are also files in Linux, issuing the following command would suffice:
file $directory_name
Checking a nonexistent file: file blah
Output: cannot open 'blah' (No such file or directory)
Checking an existing directory: file bluh
Output: bluh: directory