Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jan 1996 22:24:19 -0500 (EST)
From:      "Adrian T. Filipi-Martin" <atf3r@stretch.cs.virginia.edu>
To:        JOHN <JSINNOTT@pomona.edu>
Cc:        questions@freebsd.org
Subject:   Re: Some BASH Shell programming questions.
Message-ID:  <Pine.SUN.3.90.960104221748.25608B-100000@stretch.cs.Virginia.edu>
In-Reply-To: <01HZMBAKK3428WWXUO@POMONA.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help
	Of course, you should read the man page.  O'Reilly has a pretty 
good book on bash as well.  Here are a few examples of what you want to 
look for.

	Adrian

On Thu, 4 Jan 1996, JOHN wrote:

> First, can I write functions within a bash shell?  Right now I have a main menu

	Yes. e.g. function:
	function SayFoo
	  {
	    echo "Foo"
	    return 0
	  }

	If you are doing menus, you should also consider using the 
'select' command.  It is designed to make menus simple to code up and 
maintain.

> Second, is it possible to capture ^C and such so that a person can't exit out
> of the menu, or if they could, that at least it would output a message telling
> them how to get back to the menu?

	Check out the 'trap' command.  You can look at /etc/rc for some 
examples of its use. 

> But the cursor is always where the '_" is here, since I use the echo command. 
> Is there a way to keep the cursor right after the Command >_ ?

	echo -n "Command >"

adrian@virginia.edu                ---->>>>| Support your local programmer,
http://www.cs.virginia.edu/~atf3r/   --->>>| STOP Software Patent Abuses NOW!
Member: The League for                 -->>| For an application and information
       Programming Freedom               ->| see: http://www.lpf.org/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.90.960104221748.25608B-100000>