Try using functions for your "yes/no" results and run your "case" routine inside a "while"
loop remembering to call you functions...
Example:-
Off to work...
Last edited by wisecracker; 03-05-2014 at 04:18 AM..
Reason: Typo...
This User Gave Thanks to wisecracker For This Post:
GOTO style statements are a bad idea. Try to work out the functions of your process. I learnt this on Sinclair BASIC of all things. Using GOTO is easy to understand and GOSUB seemed excessive.
Eventually I was enlightened at school. The overall target of your code should be to perform a process. That process was split into major components, and if necessary a selection made as to which parts actually ran. For each of these major parts, we repeated the approach, and again until we could not refine it further. Each leg/relationship was either a loop, a condition or a single sequence.
Effectively coding up the lowest level respective the relationships would build your application. GOTO was not a recommended even then. We had to make subroutine and then manage the flow. Drawing up a flowchart type design with all sorts of branches quickly becomes unworkable and is a nightmare to decipher, let alone alter, evidenced by plenty of our COBOL code and C-shell scripts that I've had to extract us from in the past.
We have more ksh scripts to pick apart soon with all sorts of mad things like:-
It's just a mess when you end up with a script running to over 500 lines with one main while true loop and a huge case statement to have sections that should or shouldn't run.
Using functions helps organise your thoughts to build more structured code making it easier to understand later (when the documentation is usually long gone)
I have a long project to dismantle it all to more easily maintained code as we move the application to a replacement server. Deep joy fills me soul with the prospect.
Robin
Last edited by rbatte1; 03-05-2014 at 10:40 AM..
Reason: Emboldening
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this:
$ look "string" "/home/patrick/filename.txt"
However, this gives me the following message:
"look: /home/patrick/filename.txt: File too large"
So, I have two... (14 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi All,
I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
I have a korn script that needs to check for an empty file -- if the file is empty, I want the script to execute a cleanup step before exiting. Here's what I have:
if ]
then
echo " Input file has no records -- skipping to step 9."
goto cleanup
fi
...
... (3 Replies)
Hi,
We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0.
Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ?
I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc.
... (1 Reply)