How to mkdir only if a dir does not already exist?
I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the mkdir command to create a directory. But the directory may already exist, in which case I do not want to do anything. So I want to either test to see that the directory does not exist, or suppress the "File exists" error that mkdir throws when it tries to create an existing directory. Any thoughts on how best to do this? Try mkdir -p : mkdir -p foo Note that this will also create any intermediate directories that don't exist; for instance, mkdir -p foo/bar/baz will create directories foo , foo/bar ,