Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus batch bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory monitor motherboard mouse network operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Any Help would be apreciatted

Reply  
Thread Tools
Captainkewl's Avatar
Computer Specs
Senior Member with 121 posts.
 
Join Date: Aug 2006
Location: Ontario, Canada
Experience: Intermediate
08-Dec-2006, 10:04 PM #1
Any Help would be apreciatted
can anyone help me with this?? I don't have much experience with UNIX. Thanks

write a small suite of UNIX shell scripts to replace the
rm and rmdir commands and provide undelete capability similar to the Microsoft
Windows Recycle Bin. The scripts that you have to write are:

DELETE(1) DELETE(1)
NAME
delete - a recoverable file-deletion utility
SYNOPSIS
delete [ -r ] [ -i ] [ -f ] [ -n ] [ -v ] [ -F ] [ -D ] [--] filename [...]
DESCRIPTION
Delete marks files and directories for later permanent removal (by renaming them with a
prefix of .#). Files accidentally marked for deletion can be recovered using undelete(1). Marked
files are periodically removed automatically by the system; they can also be removed on demand
(see purge(1) and expunge(1) for details). Users can list files which have been marked for removal
but have not yet been removed using lsdel(1).
If the user does not have write permission to a file, its permissions are printed and the
user is asked whether the file should be removed. If the first character of the response line is y
the file is removed, otherwise it remains.
Users wishing to retain the user interface of rm(1) and rmdir(1) while still being able to
recover accidentally removed files can do so by aliasing rm to delete -F and rmdir to delete -D
(see below).
OPTIONS
Delete accepts the following command-line options:
-r If a designated filename is a non-empty directory, delete will signal an error
unless the -r option is specified. In that case, delete recursively deletes the
directory's entire contents and the directory itself. If the -F option is specified
(see below), delete will signal an error even if the directory is empty.
-i Causes delete to ask whether to delete each file, and, in recursive mode, whether
to examine each directory.
-f Prevents delete from asking any questions and from reporting any errors.
-n No file removals are performed. Instead, delete prints to the standard output the
files that it would remove were the -n option not specified.
-v Causes delete to report each file as it is deleted.
-F Causes delete to emulate rm by preventing it from removing even empty directories
when the -r option is not specified.
-D Causes delete to emulate rmdir by preventing it from removing anything but empty
directories.
-- Two dashes indicate that all the arguments following it are to be treated as file
names, even if they start with a dash.
__________________
AMD Athlon 64 3800 X2 (dual core) socket 939, Asus A8AE-LE MOBO, 1 Gig OCZ DDR Dual Channel 400MHz RAM, 200G Maxtor Internal HD, 160G Maxtor Internal HD,160G Maxtor External HD., 256 MB BFG Nvidia 7300 GS PCI-express video card overclocked to 637 MHz (core). Dual DVD burners with Lightscribe.
prunejuice's Avatar
Senior Member with 2,568 posts.
 
Join Date: Apr 2002
08-Dec-2006, 10:28 PM #2
What do we get for doing your homework?
Captainkewl's Avatar
Computer Specs
Senior Member with 121 posts.
 
Join Date: Aug 2006
Location: Ontario, Canada
Experience: Intermediate
08-Dec-2006, 10:55 PM #3
Lol
No, LOL, I just want to know how to get started. I'm kind of lost here. My professor is a complete bonehead, and is off in his own world.
linuxphile's Avatar
Administrator with 429 posts.
 
Join Date: Mar 2003
Location: MD
Experience: Intermediate
10-Dec-2006, 08:38 PM #4
On Windows your Recycle Bin is just another folder. Basically when you delete a file by sending it to the Recycle Bin you're simply moving it.

On Linux/Unix to do the same thing make a directory somewhere on the system. Call it trash or something. Backup your rm and rmdir command. Create shell scripts that make use of the mv command. You might also want to create a file in the user's directory that contains a list of the current contents of their recycle bin. Create symlinks (look up ln -s) to your shell scripts naming the links rm/rmdir respectively.

Have fun!
__________________
http://about.me/dmccarthy
Captainkewl's Avatar
Computer Specs
Senior Member with 121 posts.
 
Join Date: Aug 2006
Location: Ontario, Canada
Experience: Intermediate
11-Dec-2006, 06:40 PM #5
hey
thanks for your input. Here is the skeleton for the delete script. Where would I start with this?? I'm really just trying to get myself going, but I don't know how to get the ball rolling. Thanks
Attached Files
File Type: txt Skeleton_delete.txt (3.8 KB, 62 views)
linuxphile's Avatar
Administrator with 429 posts.
 
Join Date: Mar 2003
Location: MD
Experience: Intermediate
11-Dec-2006, 09:47 PM #6
Looks like you need to just execute the deletion rather than simply echoing it
echo "mv ${1} ${PREFIX}${1}"

echoing it is fine but you'll also need to do
mv ${1} ${PREFIX}${1}

Was there something else specifically you needed help with? This seems to be more than a start on this project. BTW what class and U is this for?
__________________
http://about.me/dmccarthy
Captainkewl's Avatar
Computer Specs
Senior Member with 121 posts.
 
Join Date: Aug 2006
Location: Ontario, Canada
Experience: Intermediate
12-Dec-2006, 02:34 PM #7
hey
Thanks for the reply. I was hoping that someone would know the first few lines of the script, just so I could see how it begins to flow. I am taking Computer Engineering at Niagara College in Ontario, Canada.
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
12-Dec-2006, 04:28 PM #8
Not bad; you're on the right track. Check out the man page for "getopt", as you will find that a more elegant way to process command-line arguments. Also, "case" constructs are generally easier to use than "if" to process user input.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:14 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.