|
|
|
|
|
by em-bee
457 days ago
|
|
`rm -i` shows the same warning for write-protected files' 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. |
|
On my machine, `rm -i` with a yes to a read-only file does delete that file. But maybe I'm misunderstanding what you mean by it being a no-op.
> 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.Oh yea. I've definitely run into this. Luckily, a large percentage of my stuff off my dev machine is backed by code, so I can usually just throw things away and bring them all the way back up.
> 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.
Ha. I know that feeling, and this is probably something I should've let happen to me with these dangerous commands. Would definitely make my experience with cp a lot better. I have so many aliases I've made to make my life easier, but I just end up typing in the full command every time. :D