Confirmation while deleting a file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Confirmation while deleting a file
# 1  
Old 01-25-2011
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.

# 2  
Old 01-25-2011
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):

You will often see something like:
alias rm="/usr/bin/rm -i"

I hope this helps...
This User Gave Thanks to citaylor For This Post:
# 3  
Old 01-25-2011
Thanks alot it's working fine
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Don't receive confirmation mail.

Hi Folks, I just recently registered with the username _Kaede. Unfortunately, I didn't receive any confirmation mail also not when I changed to another address. Help is very appreciated. Thanks and kind regards :) (2 Replies)
Discussion started by: Unregistered
2 Replies

2. UNIX for Advanced & Expert Users

Popup needed while reboot - for confirmation

Hi all, I need something like a pop-up while clicking on shutdown button or reboot button in GUI and also while running the command reboot / shutdown / init it should ask some confirmation message.. Do you want to do so..and so. How can i make this possible ? . (4 Replies)
Discussion started by: linuxadmin
4 Replies

3. Shell Programming and Scripting

[Solved] Use of until loop for user confirmation

Below is my script that is using to rename the name of file .Here I am using two methods to pass the both arguments wih script name or run the script and give the input one by one.But my issue is I want to rename the name of the file if user select Y(y) then it should rename the file else select... (4 Replies)
Discussion started by: anuragpgtgerman
4 Replies

4. Shell Programming and Scripting

sh script for file received confirmation

I am new at scripting, (and this fourm- so hi guys!) and I was wondering is there something out there that I can use to do the following: I receive a file on an FTP server I would like a script to look at a specifc directory for a certain file and when it arrives it will send an email... (8 Replies)
Discussion started by: mamemlin
8 Replies

5. Shell Programming and Scripting

twice confirmation in the script

from one script invoke another script will need to do double confirmation like: 'y' and 'y' exp: echo 'y' | /a/b/ only input 1 'y' in the, but the required 2 'y' (twice confirmation) is there anyway get resolve this issue? please help (2 Replies)
Discussion started by: kinx
2 Replies

6. Solaris

Netbackup Solaris Client confirmation

Greetings, I have a bunch of Solaris servers that are running Netbackup as a client. I set them up and my backup admin has confirmed that they are being backed up. But what I want to be able to do is run a command from each Solaris client to see some proof from the client side that the files... (1 Reply)
Discussion started by: BrewDudeBob
1 Replies

7. Shell Programming and Scripting

Search and Replace with Confirmation

Hi, I have created a script which searches and replace the searched text from any file in directory. I want to add a functionality where before replacing the text, script shows the line with the searched text and ask for user confirmation before replacing the text. Can this be done using SED... (18 Replies)
Discussion started by: Abhinav Tyagi
18 Replies

8. Web Development

Pop up Confirmation Box

Hi, I was writing a simple web application using Perl -CGI. When users try to do some operations, I wanted like a pop-up confirmation box. Is this possible with Perl-CGI? Thanks in advance. Regards, garric (6 Replies)
Discussion started by: garric
6 Replies

9. Forum Support Area for Unregistered Users & Account Problems

need email confirmation resent

we had a power outage shortly after i registered... so my mail server was down for a while... could i get the email confirmation for hackware --> resent please...? thanx... removed (3 Replies)
Discussion started by: hackware
3 Replies

10. UNIX for Dummies Questions & Answers

Mail delivery confirmation

If I am sending mail with this command: mail < filename, is it possible to get delivery confirmation? Thanks (3 Replies)
Discussion started by: CSGUY
3 Replies
Login or Register to Ask a Question

Featured Tech Videos