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

Dlatu1983

Prime Minister
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
 
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 $*'
 
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:)
 
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.
 
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/ :cool:
 
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.
 
Quite so. For some reason only known to its creators bash uses completely different shell scripting conventions than [t[c]sh]].
 
Back
Top