|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > ksh nested constructs (beginning student) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|