unit testing - Bash: How to test for failure of mkdir command? -
i'm writing bash script , want robust error checking in it.
the exit status code mv
make fail easy simulate failure. have move file doesn't exist, , fails.
however mkdir
want simulate failing. mkdir fail number of reasons, problems disk, or lack of permissions, not sure how simulate failure.
mkdir fail if directory exists (unless using -p), , return error code of 1
(on system), create directory first test on own system. (although assume standard across shells.)
alternatively, make parent directory read-only.
Comments
Post a Comment