6 ms·
What would be safer alternative? pwd # Then check something? pushd bin # rm -rf . Probably still with pitfalls
by malkia 2y ago
What would be safer alternative?
pwd # Then check something?
pushd bin #
rm -rf .
Probably still with pitfalls
- 01HNNWZ0MV43FF 2y ago`rm -rf bin`
- OJFord 2y agoI think the misguided belief that `./` means 'execute script' or something (program that isn't 'installed'?) is single-handedly to blame for so much script spaghetti.
- bigstrat2003 2y agoAnd not just for bin. There's probably an edge case where you would need to give the ./ prefix to rm, but I've never come across it. The vast, vast majority of the time just entering the name of the thing is easier and less error-prone.
- deleted 2y ago[deleted]
- pphysch 2y agoUse the full path of the bin dir in your rm rf
- hinkley 2y agorm -rf ~/bin could have some nasty consequences if you fat finger a return key anywhere in the middle. Run enough commands enough times and you will find Murphy is waiting for you. If you’re just removing a bin directory one time, odds are low but not zero. If you’re writing a run book for people to use, odds are 100% that you will have to help someone rebuild at least once.
- cortesoft 2y agoWrite a script that does the steps required? If the problem is defined enough to create an exact series of commands for an operator to execute, it is defined enough to create a script to do it for you