is it a trivial prblem?
Hi,
I just want to use rm as an mv in the command line to a folder called recycle and later if i really want to delete the file(s) i will delete manually. i have put this "alias rm='mv \!* ~/recycle" in the file .bash_aliases, but it didn't work. Can someone tell me why (i think it cant be bash shell) and how i would overcome the problem. One more question, how do i make mv to really move files to a different folder with a check to see if the file(s) exist. if files existed replace the extension otherwise do as normal. I think i have to use a script but i don't know and how to link/execute, could it be loaded up automatically as i open the terminal. Thanks in advance |
I assume you logged out and then logged back in, since the file you mentioned might not be read before that; you could just issue the alias command in your terminal to make it work immediately (though it is "forgotten" after you log out unless you put it in the bash's file).
To make more complicated things you just create a script and then either rename real rm and put the script in place of it, and make the script use the renamed rm, or if you like, create a symbolic link called rm that points to the script file if you don't like to put it in the bin directory (and still have the real rm renamed so that it's not overwritten). |
Quote:
Quote:
|
Is that how it exactly looks in your bash_aliases file? How exactly do you have it in your bash_aliases file?
|
yes, indeed.
in .bash_aliases file: alias rm='mv /!* ~/recycle' in .bashrc file: if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi ps: i'm using ubuntu edgy |
All times are GMT -5. The time now is 01:43 AM. |