Menu script

Jean-Pierre A. Radley appl at jpr.com
Mon Jan 3 15:42:35 PST 2005


Dennis Malen propounded (on Mon, Jan 03, 2005 at 06:24:31PM -0500):
| From: "Jean-Pierre A. Radley" <appl at jpr.com>
| 
| > Dennis Malen propounded (on Mon, Jan 03, 2005 at 04:56:36PM -0500):
| > | The following menu script is currently being used:
| > |
| > | /appl/fp/ddir msx.served -k
| > | /appl/fp/rclerk msx.served -s1 -z "addfile"
| > | /appl/fp/rreport msx.served -f import -a -h "Import AOS"
| > |
| > | The first line deletes the data from the file and then goes on to
| > | import new information into the file.
| > |
| > | I want to avoid having someone request that the data should be
| > | removed accidentally. I want to place a new first line that checks
| > | the file and determines whether it should be deleted and then
| > | import the new info. The processing to check the file is easy.
| > |
| > | The problem is, if I do not want the continue how do I avoid
| > | going to the next line. I can use "exit" from the processing but
| > | that will take me to the next line. How do I go back to the menu
| > | without continuing with the processing script if certain criteria
| > | to continue have not been met.
| >
| > Instead of just 'exit', use 'exit exitvalue'; in your script, test
| > exitvalue and proceed accordingly.
|
| Can you give me an example of what you mean? I am not grasping how
| that will skip the subsequent lines.

Sure.  Run your test_command, and arrange that if the result is that the
next group of commands should be run, then exit formn text command with
0 (success).  If the ensuing commands should NOT run, exit from your
test_command with some other number. from 1 to 255.

So:  
    test_command && {
	appl/fp/ddir msx.served -k
	appl/fp/rclerk msx.served -s1 -z "addfile"
	appl/fp/rreport msx.served -f import -a -h "Import AOS"
	echo we ran test_command, then imported new values to msx.served
    } || {
	echo we ran test_command, which told us to do nothing further
    }


[ Please do not top-post, else I'll drop out of this thread. ]

-- 
JP


More information about the Filepro-list mailing list