I recently decided that I wanted to learn more about Unix. I found this article and have been reading through it. It's pretty good thus far. I arrived at the part where they're discussing how to remove files and how you can customize terminal so that it prompts you before removal. I thought that would be good to have since I'm fairly new to Unix/Terminal. I inputted the command they gave but it will not work and I was wondering if anyone could help? Their discussion of the situation is below. Thanks in advance!
I guess I should have said specifically which commands weren't working.
I type:
% echo "alias cp cp -i \\!\*" >> ~/.tcshrc
% echo "alias mv mv -i \\!\*" >> ~/.tcshrc
% echo "alias rm rm -i \\!\*" >> ~/.tcshrc
and they are accepted with no errors but the changes never go into effect. I have opened new terminal windows and closed and reopened terminal.
OSXFaqs.com said:There is a hidden file in your home directory called '.tcshrc'. This is a configuration file used by the command line and is read each time a new Terminal is started up.
% cat ~/.tcshrc
will view it. You probably don't have one yet. We can make a new one, or add to the end of an existing one, to customise your command line experience.
If you would like the '-i' option permanently applied to cp, rm, and mv, type the following:
% echo "alias cp cp -i \\!\*" >> ~/.tcshrc
% echo "alias mv mv -i \\!\*" >> ~/.tcshrc
% echo "alias rm rm -i \\!\*" >> ~/.tcshrc
'echo' simply echoes what appears between the quotes. '>> ~/.tcshrc' says to add it to the end of the given file instead of echoing to the Terminal. We are adding lines to the '.tcshrc' file. Each is an alias that tells the command line to substitute 'cp', 'mv', and 'rm' with the text that follows.
Start a new Terminal by pressing cmd-N. When a new Terminal starts it reads the commands in '~/.tcshrc', in this case the three aliases. Now all three commands will be replaced with the '-i' versions given in the aliases, and thus always ask for confirmation before a file is overwritten or deleted.
% touch x y z
% rm x y z
If you wish to temporarily override '-i' when issuing a command, use option '-f'.
I guess I should have said specifically which commands weren't working.
I type:
% echo "alias cp cp -i \\!\*" >> ~/.tcshrc
% echo "alias mv mv -i \\!\*" >> ~/.tcshrc
% echo "alias rm rm -i \\!\*" >> ~/.tcshrc
and they are accepted with no errors but the changes never go into effect. I have opened new terminal windows and closed and reopened terminal.