Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu script - no exit

Status
Not open for further replies.

MIBrianP

IS-IT--Management
May 30, 2008
2
US
I need some help.
I am trying to write a menu script that does the following:
1. Goes out and finds certain files and puts them in a menu
2. Looks for a specific process and PID and give me the option to kill the process (with validation if possible)

Lastly, I do not want the user to be able to break out of the script. I have been beating my head against a wall to figure this one out.

this is what I have so far:
#!/bin/ksh
select dsmlog in $(find /usr/tivoli/tsm -type f -name '*.log') $(find /usr/tivol
i/tsm -type f -name '*.opt') $(find /usr/tivoli/tsm -type f -name '*.sys') $(fin
d /usr/tivoli/tsm -type f -name 'TDP*.log') $(errpt)
do
if [[ $dsmlog = END ]]
then
print "Exit option"; exit 0
fi
[ $dsmlog ] && view $dsmlog
break
done

Help me please

Brian
 
I do not want the user to be able to break out of the script
In your ksh man pages have a look at the trap command.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
No man pages on the system for trap. AIX 5.3
I will keep looking. Any other help anyone can give me in regards to some of the other areas?
 
Just a tip - it's often easier to search the larger man pages (like ksh) for individual features/switches etc if you do it online rather than on the machine in question,

I want to be good, is that not enough?
 
Insert the following as the first command in your script to prevent breakout.
Code:
trap " " 1 2 3 18
Also, if this is a startup script in .profile, call it with exec so if they exit it closes the shell.

[morning] needcoffee

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top