LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-11-2004, 05:21 PM   #1
Paxmaster
Member
 
Registered: Jun 2004
Location: unknown place in NYC
Distribution: Ubuntu
Posts: 377

Rep: Reputation: 30
making a script that will move a file or files in a trash folder


if [ -d ~/.Trash ]
then
mv ~/.Trash

else

echo " The folder does not exist. Please make a hiddin Trash folder in the in your $HOME directory. "

exit
fi

this doesnt work, because there no argument with mv but this work when i add (mv * ~/.Trash )
but as can see i want to remove a specfic file or files instead of everything.

of some one know please share it
______________________________________________________________________________________________
life is just like a candle
 
Old 12-11-2004, 05:23 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,407

Rep: Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965
how are you supposed to let this script know what file to delete? you're not giving any form of user input whatsoever.... if you want to pass it as a command lnie parameter, try "mv $1 ~/.Trash"
 
Old 12-11-2004, 05:35 PM   #3
Paxmaster
Member
 
Registered: Jun 2004
Location: unknown place in NYC
Distribution: Ubuntu
Posts: 377

Original Poster
Rep: Reputation: 30
for example lets say in a directory it contains 4 files, and 1 or 2 files i want to move, Trash filename it will go to ~/.Trash/ how will i tell bash to interpret it.

in simple word i want to do this Trash filename < will go to ~/.Trash and
Trash * this will mv everythink to Trash

basically i am learing from a documentation
 
Old 12-12-2004, 04:51 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,407

Rep: Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965
i just told you how to do that, using $1.
 
Old 12-12-2004, 05:49 PM   #5
Paxmaster
Member
 
Registered: Jun 2004
Location: unknown place in NYC
Distribution: Ubuntu
Posts: 377

Original Poster
Rep: Reputation: 30
yea thanks, but although I was trying to do somethink more to it, as u you in the last sentence i was saying about using wild card that will remove everything in the current dirctory to the the trash folder.

Would u kindly explain me what does $1 do, I could not make sense out of it
 
Old 12-12-2004, 06:00 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
man bash
/^PARAM



Cheers,
Tink
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 03:15 AM
Script to Move files jain_rajesh Linux - Newbie 1 10-15-2004 08:53 AM
ROX-filer: file deletion and trash folder woland Linux - Software 0 08-22-2004 11:16 PM
Need help with script to move files over a NFS Reggy Programming 1 03-19-2004 06:12 PM
gnome home folder and trash folder ambelos Linux - Software 2 02-24-2004 06:44 AM


All times are GMT -5. The time now is 05:20 PM.

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