3 ms·
Seems kind of strange to be trying to run: rm -rf ./* instead of just: rm -rf * Is there a difference between the two that I'm not aware of?
by jarin 15y ago
Seems kind of strange to be trying to run:
rm -rf ./*
instead of just:
rm -rf *
Is there a difference between the two that I'm not aware of?
- pyre 15y agoIf any files begin with '-', the second version will just expand to '-filename' which rm will try to process as an option (possibly failing or creating undesired results). Using ./* expands to ./-filename which won't be picked up by option processing. Note: You can also do rm -rf -- * to prevent option processing after the '--'. edit: added a bunch of breaks to prevent the * from being converted to italics.
- antifuchs 15y agoThe former will gleefully delete all files/directories, even if there exists a directory entry named "-i", without asking. The difference is in glob expansion: ./* keeps the prefix on every expanded item. As mentioned above, using any sort of path (relative or absolute) prefix when globbing will circumvent all the careful "-i" wards a superstitious sysadmin may have put in place.