I would like to test if a directory exists. If not, mkdir it. I wrote code like this:
#!/usr/bin/perl if (! -d abc) { mkdir "abc", "0777" or die "Can't mkdir abc: $!"; }
I guess if the directory exist, there would prompt nothing. But it is interesting that the linux prompts "Can't generate abc: File exists". Can anybody help me to understand why the code still want to mkdir even if (! -d abc) implies false? thanks.
In reply to mkdir usage by skyworld_chen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |