The Prodigal Son


 
Thread Tools Search this Thread
The Lounge What is on Your Mind? The Prodigal Son
# 1  
Old 07-30-2013
The Prodigal Son

About 10 years ago I got into K shell scripting in a big way (for a beginner). I absolutely loved it and wrote a number of database maintenance scripts that, while basic, worked extremely well.

Somehow, somewhere I picked up the style of scripting that was very similar to when I was doing Cobol programming, a central "command center" type structure (that was usually at the bottom of the script), that would direct the code to, for example, run section/paragraph/function (whatever the proper name is) 1, return to the command center, then run 2 etc. I saved off my scripts on a CD and they were lost in a move.

I spent the next 10 years in a position that did not involve scripting and I lost/forgot much of what I knew. Now I am again in a scripting position. I'd love to work on being able to recreate some of those type scripts but I haven't been able to find any source on the web or elsewhere that would detail that type scripting.

Can anyone point me to a source, book, web site etc that would enable me to get back to that type of scripting by function/module etc?

Many thanks.

Last edited by Scott; 07-30-2013 at 06:06 PM.. Reason: Thread moved
# 2  
Old 07-30-2013
# 3  
Old 07-30-2013
Thanks but I have many of those. That's not what I am asking. I am asking about a source thats specific to scripting by functions. The same sort of scripting/programming that can is typically done in Cobol. Most scripting books I've seen are strictly sequentia/procedurall reading from top down.
Thanks again.
# 4  
Old 07-31-2013
Do you mean something like the following?


Code:
function get_input
{
 # blah blah
}
function process_data
{
 # blah blah
}
function print_output
{
  # blah blah
}
# main
get_input
process_data
if [ $? -eq 0 ]
then
  print_output
fi

# 5  
Old 07-31-2013
Roger thatSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can i use fork,sleep,wait and write in a process with father and son..??

Hi.. I was unable to do (gcc code) which refers to the fork,wait,sleep and write.. what i want to do: A process of father create (fork) a son and will sleep 90 seconds..After this, son process create a grandchild and will sleep 60 seconds..Grandchild process will sleep for 30 seconds..After... (3 Replies)
Discussion started by: gumlucin
3 Replies
Login or Register to Ask a Question