LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-28-2007, 03:44 AM   #1
thtr2k
Member
 
Registered: Mar 2005
Location: Australia
Posts: 71

Rep: Reputation: 15
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
 
Old 01-28-2007, 03:52 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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).
 
Old 01-29-2007, 12:10 AM   #3
thtr2k
Member
 
Registered: Mar 2005
Location: Australia
Posts: 71

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by b0uncer
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).
what the ... i know that. i ran "source .bash_aliases" and my .bash_aliases file is already enable in the .bashrc file. i also closed the terminal and reopen it. According to what is said i don't think the command "alias rm='mv \!* ~/recycle" works in bash shell.
Quote:
Originally Posted by b0uncer
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).
Great help
 
Old 01-29-2007, 12:19 AM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Is that how it exactly looks in your bash_aliases file? How exactly do you have it in your bash_aliases file?
 
Old 01-29-2007, 08:32 AM   #5
thtr2k
Member
 
Registered: Mar 2005
Location: Australia
Posts: 71

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xauthority file prblem incognito_kanchi Linux - Desktop 1 01-17-2007 11:56 PM
Apache - Prblem with .htaccess -- please help me b:z Linux - Networking 1 04-11-2005 01:49 AM
mplayer prblem!!1 jaspreet85 Linux - Software 5 03-27-2005 04:13 PM
Media check prblem rbchhan Fedora 1 07-29-2004 11:00 AM
unbelievable UT install prblem salparadise Linux - Newbie 1 03-04-2003 11:44 AM


All times are GMT -5. The time now is 12:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration