3 ms·
If you want to blow away a directory, do this just to avoid wildcard games: rm -rf $the_dir && mkdir $the_dir Yes, it's technically slower, but this is shel
by koenigdavidmj 12y ago
If you want to blow away a directory, do this just to avoid wildcard games:
rm -rf $the_dir && mkdir $the_dir
Yes, it's technically slower, but this is shell.
- perturbation 12y agoShould mkdir be first (so that it short circuits if $the_dir is unset?) I haven't done anything in bash in a while but that seems to be how it works on my computer (Debian Wheezy, bash 4.2.37).
- koenigdavidmj 12y agoThe original broken code was using a wildcard to clear a directory. I proposed a safer way of doing that: delete the directory itself then recreate it.