>> Can anyone provide me a solution for the following?
> Well, we can provide some ideas...
>> My requirement is( a C program) :
>> From the unix home directory if I execute the program,
>> the command prompt has to change to the name of the program that I execute.
>> #anil:> <---- This is my unix home dir
>> #anil:> Hello <----If I run Hello
>> #Hello:> <---It has to change to Hello.
>> And also I should be able to run commands from Hello prompt and if I type
>> QUIT it has to come back to #anil:> prompt.
> Since this sounds like a homework question I'll be vague. Look on google
> for the environmental variable that changes the prompt in bash. This
> should take about 5 minutes to find. Now, do a 'man -k environment' and
> look at the function calls that come up dealing with setting/getting
> environmental variables. I've never done this, so I may be wrong, but
> this is the direction I would look in... Also, if your "QUIT" is not
> actually a separate program, then it looks like you may just need to
> spawn a new shell and change the prompt. At any rate, you have some
He probably will have to spawn a new shell from his program because the
program can't change the environment of the shell he started the program
from. So, setting an environment variable from within his program and
then exiting won't help because only programs started from within his
program inherit the changed environment. Thus having a look at the man
pages for execl(), execlp() and friends (and, of course, setenv()) is
something that needs to be added to the TODO list.
_ _____ _____
_ | | | | | | AG Moebius, Institut fuer Molekuelphysik
| |_| | | | | | Fachbereich Physik, Freie Universitaet Berlin
\___/ens|_|homs|_|oerring Tel: ++49 (0)30 838 - 53394 / FAX: - 56046