Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bash warnings?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Yamar
n00b
n00b


Joined: 08 May 2004
Posts: 14

PostPosted: Mon May 17, 2004 4:18 pm    Post subject: bash warnings? Reply with quote

Is there any way to enable warnings for rm, cp, mv etc. in bash? For example if I do a:

rm foo

it will ask if I'm sure I want to remove the file before removing it.

I've had this in other distros. How do I enable it in Gentoo?

I've searched the forums and google and didn't find anything on this.

TIA
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Mon May 17, 2004 4:37 pm    Post subject: Reply with quote

Basically you've got to look up in the manpage ("man cp" etc.) how to have it ask for confirmation and then add an alias for it. Putting it in ~/.bashrc makes it available automatically.

I don't know how other distros accomplish this, but I'm pretty sure they just put something like
Code:

alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"

in /etc/skel/.bashrc.

You want to add the above to /home/<your-username>/.bashrc
Back to top
View user's profile Send private message
Voltago
Advocate
Advocate


Joined: 02 Sep 2003
Posts: 2593
Location: userland

PostPosted: Mon May 17, 2004 4:37 pm    Post subject: Reply with quote

Add to your /etc/profile the line
Code:
alias rm="rm -i"
Back to top
View user's profile Send private message
Yamar
n00b
n00b


Joined: 08 May 2004
Posts: 14

PostPosted: Mon May 17, 2004 4:51 pm    Post subject: Reply with quote

Thanks for the fast replies! It's working now :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum