4 ms·
I hadn't realized there was a built in "interactively delete files asking the user" command, "dsw" this far back. I wonder when and why it got dropped? > For e
by jdougan 2y ago
I hadn't realized there was a built in "interactively delete files asking the user" command, "dsw" this far back. I wonder when and why it got dropped?
> For each file in the given directory ("." if not
specified) d_s_w_ types its name. If "y" is typed,
the file is deleted; if "x", d_s_w_ exits; if anything else, the file is not removed.
- blueflow 2y agoA Brief History of the 'rm' and 'rmdir' commands : https://linuxgazette.net/issue49/fischer.html https://linuxgazette.net/issue49/fischer.html
- 082349872349872 2y agoIt probably got dropped when more orthogonal ways to do the same thing were better supported. Before looking for a builtin command to do that, I'd execute a find(1) in my editor to load a buffer up with potential files to delete, and then xargs(1) the edited buffer to rm(1) them; without xargs I'd probably just prepend "rm -f" to all lines and then execute the whole buffer; if I wished to do it the slow way I could pipe those names through a shell loop; etc. etc. (with ed(1) you'd need to first write the buffer to the filesystem, then bang-execute it, but the same workflow would suffice even on a hard tty) EDIT: see sibling for real story: dsw(1) was meant to remove files with shell-inexpressible filenames, so none of the above would apply. Not being a unix-kernel hacker (and not having had my shell sessions corrupted by noise chars due to someone attempting to use the modem line for voice in decades), I've always managed to use wildcards to get a suitably-unique typeable match to the occasional binary-named junk file.
- m0llusk 2y agoReplaced by rm -i perhaps?
- jdougan 2y agoThe problem with rm is that it defaults to "you asked for it, you got it" mode and will delete things not intended without warning. If dsw (or related standard utility that defaults the other way) was there you could hand that to users and be a lot less likely to have accidental deletions.
- adrian_b 2y agoAliases solve the problem of undesirable default options in most shells. I have not used cp or rm with their default options for decades, because I always use aliases that set correct default options. Similarly for many other traditional UNIX utilities.