LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   red hat deleting a file (https://www.linuxquestions.org/questions/linux-software-2/red-hat-deleting-a-file-283661/)

0007 01-29-2005 08:18 AM

red hat deleting a file
 
hi everyone,

i have redhat 9 and when i delete a file , it gets deleted automatically, i mean without asking. does any1 knw how i can prompt a message saying do u want to delete the file yes or no.

perfect_circle 01-29-2005 08:35 AM

Quote:

i have redhat 9 and when i delete a file , it gets deleted automatically, i mean without asking. does any1 knw how i can prompt a message saying do u want to delete the file yes or no.
do you mean from the console when you delete an file with rm?
If yes rm has an option -i for interactive mode

Code:

skalkoto@darkstar:~$ touch nothing
skalkoto@darkstar:~$ ls -l nothing
-rw-r--r--  1 skalkoto users 0 2005-01-29 16:30 nothing
skalkoto@darkstar:~$ rm nothing
skalkoto@darkstar:~$ touch nothing
skalkoto@darkstar:~$ ls -l nothing
-rw-r--r--  1 skalkoto users 0 2005-01-29 16:30 nothing
skalkoto@darkstar:~$ rm -i nothing
rm: remove regular empty file `nothing'? y
skalkoto@darkstar:~$

You may do an alias to use rm -i instead of using rm, when you type rm.:
Code:

alias rm='rm -i'
To make it permanent put this in one of your configuration files like .bash_rc (I think this is the file in RH) in your users home directory


All times are GMT -5. The time now is 08:36 PM.