LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Menu system scripting (https://www.linuxquestions.org/questions/linux-newbie-8/menu-system-scripting-27889/)

Nelleh 08-14-2002 04:49 AM

Menu system scripting
 
I dont know if this should go in programming, feel free to move it if needed.

I have a number of "widgets" that I have built a shell script menusystem around and was wondering whether someone can point me in the right direction about finding some answers to some of the following queries I have.

1) I want to be able to create an account that can only use this menu system when it logs in. That side of it is not too much trouble, but how do I ensure that when they exit the menu, they are logged out of the system totally?

2) On a related issue, how do I stop them issuing a ctrl+C (or any other escape character sequence) to exit the script?

3) And I know this is pretty unimportant to the functionality, but is there a guide to text formatting? I wouldnt mind making it a little bit clearer with colour or two, bold text that sort of thing.

4) I've run into a number of options for building menus (PS3/case, read and so on) but is there a guide that anyone knows of setting out the options available? I've been using PS3/case to date, but while it is easy for a n00b like me to figure out, it seems very restrictive in how the menu is formatted and there was not much behind the reasoning for using it in the original site I found suggesting other than it seems to be the easiest to set up, but I'd like a bit more flexibility if possible.

Thanks in advance

crabboy 08-15-2002 09:20 PM

These are the questions I can answer:
1) Change the login shell in the /etc/passwd file for the user to be the name of the script. When the script exits the shell will exit.
2) You can capture signals in a script like this. This one captures ^C or SigInt.
Code:

#!/bin/sh

SigInt()
{
    echo "Caught SigInt"
}

trap "SigInt 2" INT

# Start script here
echo hello

3) Donno, try looking at tset. I know you can set bold text with it, don't think colors thought.
4) Donno

Yes, this is probably a programming post. Not much newbie content here.

Nelleh 08-16-2002 04:37 AM

Thanks for your help, got the important questions answered at least :-)


All times are GMT -5. The time now is 03:29 PM.