|
|
|
|
|
by jmholla
454 days ago
|
|
This is true, but as you note, `rm -i` shows the same warning for write-protected files. My alias is intended to provide the same protection against accidental deletions of non-write-protected files. I only pass the `-f` when I'm certain I know what I'm doing. If I still want the raw behavior as you called out, I can use the full path to `rm`. But for me, I've unintentionally lost more files that I have write permissions on through bad rm commands than any lost from my alias with `-f`, which I can't recall having lost any with. |
|
because for write-protected files '-i' is a no-op.
you are probably right that the risk of accidentally deleting a write protected file is very small, simply because using those permissions is very rare.
but there is another problem i have with using an alias, this may not apply to you, but i work on multiple machines and in containers, and i keep creating new ones for projects, that there is a high risk that i forget to set the alias. so every time i use rm i can't be sure, did i set the alias, or did i not. and if i rely on 'rm' always asking me, then it makes me complacent. ah, i don't have to pay attention because rm will ask me anyways.
writing 'rm -i' explicitly every time makes it much easier to see that '-i' is indeed being invoked. it makes me pay attention and i know that i am running the command that i want. it's three extra characters to type each time, but it has become muscle memory. i don't think about it anymore, except when verifying what i typed. the '-i' just has to be there.