simple shell scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting simple shell scripts
# 1  
Old 11-27-2005
Computer simple shell scripts

hi everyone...
i'm new to this shell programming and i want help with the following question...
i hope someone can help me ...pls plsssssssssss

==========================================================
the question
==========================================================
A number of users have changed from Windows to Unix and are missing the ability to restore deleted files from the recycle bin. You are going to provide them with a simple set of scripts which will provide a functionally similar feature, but without the irritating Windows 'do you mean this?' dialogue.

In Unix, if you type rm filename the file is deleted. So to cater for those who long for the ability to restore deleted files, this part of the assignment is to write four shell scripts - del, rest, empty and initialise - which will delete a file to the trash can, restore it, empty the trash can or set up the system respectively. The trash can should be a directory called .trash below your home directory. It should be set up by initialise.
The specification for del is del filespec, where filespec is one or more files or directories (you should be able to use wildcards). The deleted files should be moved to the trash can. rest should restore a file to its correct directory from the trash can. If you type rest by itself you should get a list of the files in the trash can in the form nSmilieath where n is a number and path is the path from where the file was deleted.

For example,
0:/home/smr/msccw/results
1:/home/smr/msccw/delly
2:/home/smr/msccw/tmp

You can then type rest 1 to restore the file delly. Note if you delete two files with the same name, they should both be saved in the trash can and you should be able to restore either or both of them.
empty will just empty the trash can.
initialise just sets up any directories, files etc that the system needs and should be run once before using the other scripts.
You may assume that the user has a bin directory which is on their PATH
You should make the scripts as robust as possible since they will be used by ex-Windows users. They should be designed to operate from a directory on the users path (e.g. $HOME/bin) You should bundle them up into a self extracting file called safedel. which should be in your bin directory. You should give us read access to this file (Brian and myself). You will lose marks if we can't access it. See the Unix notes for bundle. N.b.Your scripts should be called del, rest, empty and initialise, not some names you would prefer..
# 2  
Old 11-27-2005
Please make sure that you have read our rules. And note:
(6) Do not post classroom or homework problems.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Simple (un-)installation of scripts using YASSI

Heyas Recently i've been 'fighting' with the GNU Autotools (autoconf, automake) to distribute one of my script based projects. Figured that these tools are very powerfull, and therefor can be very hard to learn/master. This said, a new personal project was started, inspired by the GNU... (0 Replies)
Discussion started by: sea
0 Replies

2. UNIX for Dummies Questions & Answers

Create a simple web portal/GUI to execute scripts?

Very new to this..... What I would like to do: Create a simple GUI/Web portal with 3 buttons and 1 text field The three buttons need to take the input into the text field and use that as the variable to execute scripts located on a server Problem: How can i get the buttons on the... (3 Replies)
Discussion started by: poops
3 Replies

3. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

4. UNIX for Dummies Questions & Answers

New to shell scripts

Hi, Probably a real easy one for someone...I need to have a scheduled cp job run from crontab to copy certain files and directories to a shared NFS storage. The script I have works fine, except I need to exclude certain directories to stop issues with symbolic links, can someone explain... (2 Replies)
Discussion started by: paul.duncalf
2 Replies

5. Shell Programming and Scripting

simple shell - how to get a parameter typed in a shell script

Hi, I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies

6. AIX

Shell Scripts

I would like to seek some expertise of all our AIX experts on board. 1) I would like know how to get a return exit code of a command. I found that there are exist code for each and every command run in AIX but I just can't get the return code from my scripts. A=`cp /home/abc/abc.txt... (7 Replies)
Discussion started by: kwliew999
7 Replies

7. Shell Programming and Scripting

Need a simple file based utilty for shell scripts

Hello, I'm wondering if you may know of a simple file based UNIX utility that can be used to store and retrieve values on a flat file, let's say i have a file called "kru", i'd like to be able to specify a request like: while(....) if ; then kru.fld2 = $rec_cnt kru.fld3 =... (4 Replies)
Discussion started by: bobk544
4 Replies

8. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

9. Shell Programming and Scripting

two simple question on shell scripts....

:D my first question is how can envoke filename expansion from within a shell script.. forinstance if i execute the script and it asks for a specific directory that i would like to cd to, how can i get the script to use the same file name expension as the command line.. my second question is how... (3 Replies)
Discussion started by: moxxx68
3 Replies

10. UNIX for Dummies Questions & Answers

about shell scripts

Hi, i have made a script which makes some analyses on some differnet hosts. but i have a problem to make this script more quicker ... i would like to enter more a one hosts in the query (in my script are this: Pls enter the Hostname ... read hostname for i in $hostname do echo... (5 Replies)
Discussion started by: scottl
5 Replies
Login or Register to Ask a Question