making a script that will move a file or files in a trash folder
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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"
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.