UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 11th, 2003, 12:57 PM
Hermine Hermine is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 Hermine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy ksh nested constructs (beginning student)

I'm a beginning student, so please be patient with me and don't flame me for posting what will probably seem like a very stupid question.
I'm working on a relatively basic ksh script for a 100 level UNIX class.
It's a script to duplicate rm-i with a few more bells and whistles, based on pseudocode from our professor.
Unfortunately, I was sick the day we covered the material I would need to do this project and I've been beating my head against this thing for a couple of days.
I think the problem is with the fact that I have multiple nested constructs and I don't really know all the rules for doing that, so I'm probably making some sort of faulty assumption based on my experience with C.
Thanks in advance for the advice.
Here it is, aveq comments:

clear
echo
echo
echo
echo "****************************************"
echo "** **"
echo "** MAIN MENU **"
echo "****************************************"
echo "** **"
echo "** [D] to delete a file interactively **"
echo "** [E] to exit **"
echo "****************************************"
read response #get choice from above menu
case $respone in #first/outermost case
d|D) echo "Please enter the name of file to be deleted" #prompt
if test-e $filename #if within outer case. synatax?
then
echo "Do you want to delete $filename?"
#prompt for confirmation.
read confirmation #confirmation (y/n)
case $confirmation in #second/innermost case. w/in if.
#error in this section
y|Y) rm $filename
echo "File removed."
n|N) echo "File not removed." #I don't know what #happens here. Will it read new input or do I have to run menu?
*) echo "Please respond with y or n."
#same as above. Just don't know enough abt. how this will be
#handled. Cd. also be mixed up w/ outer case.
esac #this should close innermost case.
else echo "File not found" #continuation of if construct
#can I do multiple commds. in this situation?
echo "Please try again."
ksh menu
fi #close if construct
E|e) exit
*) echo "Please enter a menu option."
#err. msg for outer case.
ksh menu #return to menu
esac #close outermost case

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > ksh nested constructs (beginning student)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway