LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2014, 08:05 PM   #1
highland
LQ Newbie
 
Registered: Nov 2014
Posts: 9

Rep: Reputation: Disabled
Two scripts, delete and restore


Hello, just wondering if anyone on here can help me. I'm very very new to linux, and i am currently using VM Player to run an ISO which has a GUI and seems fairly simple. I am trying to create two scripts, one to delete a file (basicly move it some kind of recycling bin where it can be restored) And a restore script, to put that file back into its original directory. This seems fairly simple however i find myself scratching my head when it comes to scripting. Any help would be great, thanks!
 
Old 11-24-2014, 08:18 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,862

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
Welcome to linuxquestions.


Quote:
Originally Posted by highland View Post
one to delete a file (basicly move it some kind of recycling bin where it can be restored)
That can be done with the mv command.

Look at:
man mv

Quote:
Originally Posted by highland View Post
And a restore script, to put that file back into its original directory.
That can be done with the cp command.

Look at:
man cp

----------------------------
Steve Stites
 
Old 11-24-2014, 08:29 PM   #3
highland
LQ Newbie
 
Registered: Nov 2014
Posts: 9

Original Poster
Rep: Reputation: Disabled
thanks, how would i go about actually creating these scripts, so that in console i could type for example del <pathname> the file will end up in the dustbin in a retrievable state, and restore <filename> back to where it was? I'd like ideally for the restore script to add .back to a restored file if there is a file in there already with the same name
 
Old 11-24-2014, 09:10 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,862

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
You create a script by creating a text file with a text editor and then make that file executable. The text file is a series of commands.

Here is a step by step tutorial on how to do that:

http://linuxconfig.org/bash-scripting-tutorial

----------------------------
Steve Stites
 
  


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
backup/restore scripts StaffSergeant Programming 5 12-08-2011 04:00 PM
[SOLVED] Mysql Backup & Restore scripts ramecare Linux - Server 3 04-11-2011 05:29 AM
Site definitely hacked. Can't delete files to restore backup. painterj Linux - Security 9 04-10-2010 07:38 AM
Need a fresh pair of eyes to review my backup+restore scripts BassKozz Linux - Newbie 6 06-01-2009 04:51 AM
how to restore the startup scripts after removal kushalkoolwal Debian 6 05-10-2006 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration