alias for rm directory - prompt
Hi members,
I've an alias for rm to prompt whenever I delete any file as: Code:
#Make rm as interactive This works as good as I had wanted. Is there a way I could alias for rm -rf, and fuse it with interactive flag? Any guidance would be highly appreciated. |
Based upon your .bashrc, anyh occurrence of rm should automatically include -i so an
Code:
rm -fr Code:
rm -ifr |
If you have an alias setup say
Code:
rm='rm -i' Code:
\rm -rf |
Quote:
Thanks for your reply. Unfortunately, this doesn't happen when I remove directory. :( |
open a terminal and issue:
Code:
type rm Nevermind. That's a strange one. Directories get clobbered silently. Code:
type rm Code:
touch xyz I guess I'm missing something basic. Can I blame too much|little caffeine? |
Quote:
Hi lazydog, Thank you for your reply. Code:
rm one.txt mkdir out_rm But Code:
\rm -rf out_rm |
Quote:
Please see the output: Code:
$ type rm |
|
Quote:
Thanks for your time, and reply. By files I refer to as .txt, .fasta, .c, .py, .php, .cpp, .hpp, .h, .js, .etc, any random document/file present in any directory. Code:
touch file.txt I think we're on the same page, and not misunderstanding any thing. By directories, I refer to folders. Yes, it is a strange. I wanted to be more wary while using rm, and thus, looking out for options that could make it interactive. :) |
Quote:
Since I have the same .bashrc I've had for about 5 years, the only interactive rm'ing I see are on remote hosts, servers all. I suspect rm has been "made interactive" in recent desktops. On remote hosts, at the very first prompt on "rm /some/file" I hit control+C and then issue the same command with Code:
\rm some/file |
The -f switch takes precedence over -i, no?
edit Code:
rm -rfi # interactive |
Quote:
Code:
-f, --force I'm gonna say too much caffeine on this one! (facepalm) Thanks! |
Quote:
Oh! I see. :D @habitaul, keefaz, lazydog Thank you very much for digging this one out. :) |
Quote:
eg Code:
rm -rif => f takes priority over i |
Quote:
Gotta Love It. |
All times are GMT -5. The time now is 11:35 AM. |