> > I considered "alias rm='rm -x'" in a profile, and planned to remember adding
> > -f when needed.
>
> If you're going to hack your profile already, you might as well just
> implement the logic there, so that it works on all the systems you
> carry that profile to instead of only those where rm has been hacked:
>
> function rm {
> local rmopts arg
> for arg
> do
> case $arg in
> -*) set -A rmopts -- "${rmopts[@]}" "$arg";;
> *) command rm "${rmopts[@]}" "$arg" || return;;
> esac
> done
> }
Thanks for caring Philip. My shell-fu just improved. While I appreciate
your solution and it's portability, it takes away my right to shoot myself
in the foot:
$ touch -- -foot; rm -- -foot; ls -- -foot && echo CLICK || echo BANG
-foot
CLICK
$ touch -- -foot; command rm -- -foot; ls -- -foot && echo CLICK || echo BANG
ls: -foot: No such file or directory
BANG
I have no doubts it's possible to mimic every arcane aspect of getopt
with a more complex shell-function. I am not so sure however, I would
like to trust this complexity transforming more or less random input
from commandline into invocations of rm.
Well -- I have received a "No thanks" and a alternative solution I do
not love. Maybe it's time for me to shut-up and just keep my patch
for my own local pleasure.
Honestly, ultra-conservatism keeping everyone out of trouble is not the
least of the reasons I am using obsd for. So I get what I paid for.
Thanks for your time.