Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-12-2007, 03:23 PM   #1 (permalink)
 
Newb Techie

Join Date: Mar 2007

Location: South of Ireland

Posts: 35

mitzi is on a distinguished road

Default Shell Programming

Hi guys,
doing my first unix shell programming assignment and I was just wondering if someone might take a look at it, just to see how I'm getting along. Sorry about it being a long post. I don't want or expect anyone to do my assignment, just to let me know how I'm getting on with it for my first try.

A successful run should look like this

Please enter the name of the subdirectory: subdir1
Please enter the name of the file to copy: filename
filename has been successfully copied to the subdirectory subdir1


This is what I have come up with.

echo "please enter the name of the subdirectory: \c"
read subdir1

if test "${subdir1}"
then
if test -d "${subdir1}"
then
echo "please enter the name of the file you wish to copy: \c"
read filename
if test "${filename}"
then
if test -e "${filename}"
then
cp "${filename}" "${subdir1}
echo "${filename} has been successfully copied to ${subdir1}"
else
echo "${0}: ERROR: ${filename} does not exist
exit 0
else
echo "${0}: ERROR: No filename entered
exit 1
else
test ! -d "${subdir1}"
then
mkdir subdir1
else
echo "${0}: ERROR: No home directory entered"
exit 3


Last edited by mitzi; 11-12-2007 at 04:20 PM.
mitzi is offline  
 
Closed Thread

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming language for Web Conferencing anshu Programming Discussions 1 10-02-2007 11:47 PM
Any programming experts (Javascript?) I need a job done, will pay Quintox Programming Discussions 2 08-01-2007 05:29 PM
New to programming completely... wanna make use of the school years vernong1992 Programming Discussions 6 07-31-2007 04:41 PM
New Hack Technique Exploits Common Programming Error Osiris Virus - Spyware Protection / Detection 0 07-23-2007 02:26 PM
Programming software help Sgt Wild Lion Windows Operating Systems and Software 0 07-16-2007 12:10 PM