# Are you sure you want to delete? y or n....help!



## Dlatu1983 (Jul 15, 2003)

What's the terminal command I use to make the shell confirm before I delete a file?

I had it set on my last mac, but I don't remember how I did it


----------



## cfleck (Jul 15, 2003)

rm -i


----------



## bbos (Jul 15, 2003)

man rm # to tell you the argument

Then you need to alias this in the ~/.tchrc file or ~/.bashrc or whatever:
alias rm='/bin/rm -i $*'


----------



## Dlatu1983 (Jul 15, 2003)

what I should have asked was this....what's the string I type in that programs the terminal to ALWAYS require confirmation before I delete a file? I had it before, and I forgot how I did it (new computer)...thanks


----------



## Darkshadow (Jul 16, 2003)

Heh, *bbos* typed it.  Re-read that post.


----------



## Dlatu1983 (Jul 16, 2003)

Well, I'm a UNIX virgin, so I have no idea what that means @ all. I know VERY little UNIX, and all I know is that last time, that just gave me a lin eof text to type in, and it set "confirm" as the default.


----------



## michaelsanford (Jul 16, 2003)

Wellll:

1. Open Applications -> Utilities -> Terminal
2. Type *pico .tcshrc*
3. Go down to the bottom of the file and paste *alias rm='/bin/rm -i $*'*
4. Type CONTROL-X to exit pico, answer "y" to do you really want to exit and hit return to save it as ".tcshrc".
5. Type CONTROL-D to log out, and restart the shell.

Now you will always be prompted.

PS I'm working on a little shell scriptlet that maps "rm" onto "rm_trash" that will put your files into ~/.Trash/


----------



## Darkshadow (Jul 16, 2003)

Heh, I wrote a program that will do that myself.

Called it rmtrash, too.


----------



## Dlatu1983 (Jul 16, 2003)

For some reason, it didn't work...grrr...


----------



## Eckhart (Jul 17, 2003)

Ok, the easiest way I can think of:

1. cd
2. cat >>.cshrc
3. type in: 
alias   rm   'rm -i \!*'
4. hit CTRL-D

Open a new shell. What bbos && micheal told you about "alias rm='something'" is not going to work for the (T)CSH. The "alias" built-in requires two whitespace-separated arguments. 

What they meant more or less works for bash, but then you need to erase the "\!*" at the end. "alias rm='rm -i'" would do then.


----------



## slur (Jul 18, 2003)

Quite so. For some reason only known to its creators bash uses completely different shell scripting conventions than [t[c]sh]].


----------



## michaelsanford (Jul 18, 2003)

Woops  you're right...


----------

