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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -