Confirmation while deleting a file

Hi All,
While am deleting a file in unix by using the command rm it's deleting the file directly
IT's have to ask the user while deleting like

do you want to delete filename y or N ?

Kindly help on this.

Thanks
Thelak

The "rm" command can be passed the "-i" option for the user to confirm they actually want to delete the file, directory, etc. Lots of administrators alias the "rm" command so that it automatically passes in the "-i" option, especially when they are logged on as root, as accidents can often prove fatal. There are two ways of setting these aliases, to define a shell function or to create an alias. To see your functions type:

set | more

And to see your aliases type (some shells do not have aliases, so you may get an error):

alias

You will often see something like:

alias rm="/usr/bin/rm -i"

I hope this helps...

1 Like

Thanks alot it's working fine