The Computer Oracle

Saying 'yes to all' using rm -i

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: The Builders

--

Chapters
00:00 Saying 'Yes To All' Using Rm -I
00:32 Accepted Answer Score 7
00:44 Answer 2 Score 3
00:54 Answer 3 Score 4
01:11 Answer 4 Score 13
01:35 Thank you

--

Full question
https://superuser.com/questions/262869/s...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#rm

#avk47



ANSWER 1

Score 13


Well, this doesn't really answer your question. But instead of using rm -i, consider aliasing rm to rm -I:

The man page states:

-I     prompt once before removing more than three files, or when removing 
       recursively. Less intrusive than -i, while still giving protection 
       against most mistakes

in your ~/.bashrc, put:

 alias rm='rm -I'

this is actually useful!




ACCEPTED ANSWER

Score 7


No.

(Unless you find a way to flip the 'interactive' bit with a debugger.)




ANSWER 3

Score 4


If you are running in screen (a good idea in general), you can do:

ctrl-a : exec .! yes y

This would cause screen to run the 'yes' command with y being the output, and direct said output to the running program (rm -i).




ANSWER 4

Score 3


Just check first using ls *.bla and then rm -f *.bla maybe?

Use caution!