|
From: | Guido Flohr |
Subject: | Re: Feature request: rm should implement option -p, --parents |
Date: | Tue, 07 Jul 2009 12:23:54 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090423) |
Jim Meyering wrote:
Guido Flohr wrote:Sure. But compare that to: rm -p $file Clearer and more efficient to boot.It is hard to justify adding an option to GNU rm when you can get the desired functionality via a tiny shell script: #!/bin/bash fail=0 for f in "$@"; do unlink "$f" || { fail=1; continue; } parent=$(dirname "$f") rmdir -p "$parent" || fail=1 done exit $fail
Or even simpler because "rmdir -p" never has a zero exit-status.But if I compare that to "ls -B" which is ridiculously easy to replace, the option "-p" for rm is a lot more useful. Besides, you could also get the functionality of "rmdir -p" with a tiny shell script.
Utilities are meant to make life easier, and I think that the option -p is just as useful for rm as it is for rmdir.
Cheers, Guido -- Империя ООД | Imperia OOD ул. „Княз-Борис-I“ № 86, София 1000 | ul. "Knyaz-Boris-I" № 86, Sofia http://www.imperia.bg/
[Prev in Thread] | Current Thread | [Next in Thread] |