Re: Feature request: rm should implement option -p, --parents (original) (raw)
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