I asked the net previously a question like this, and the silence was
sort of numbing. :-) I'll try again in different words.
I am using Microport System V/386 3.2, but would like as portable of a solution
as I can get.
What I would like to do is to get have a hook in the PROMPT-READ-EXECUTE
loop of the "sh" shell so that I get the loop HOOK-PROMPT-READ-EXECUTE
where HOOK executes a program or shell script of the user's choice
before each prompt.
The best I can come up with is to write a short C program with pseudo-code
as follows:
main
{
for (;;;)
{
fork
if child
execl /bin/sh sh cmd hook null
prompt
read cmd
fork
if child
excecl /bin/sh sh cmd null
}
}
This program would be invoked by the last line of the .profile. I am pretty
sure that it will sort-of work, but it seems rather clumsy and inefficient.
Is there a better way? Are there any hidden gottchas?
(I would consider changing to another shell, but my impression is that "sh" is
the most portable).
Thanks in advance for the help,
Orville.
-------------------------------------- ******************************
Orville R. Weyrich, Jr., Ph.D. Certified Systems Professional
Voice: (602) 391-0821 POB 5782, Scottsdale, AZ 85261
Fax: (602) 391-0023 (Yes! I'm available)
-------------------------------------- ******************************