Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Simple way to get parent process name?



In message <19980915151323.A5205@xxxxxxxxxxxx>, Dan Nelson writes:
>In the last episode (Sep 15), Ken Lareau said:
>> At my current job I compile a lot of various packages, and tend to
>> log my configuration, compilation and installation procedures for
>> future reference, using the 'script' command.  To keep myself from
>> getting confused as to whether I was in a 'script' process or not, I
>> would have the shell prompt change to something else while running
>> 'script'.
>
>How about
>
>script () { 
>  export INSCRIPT 
>  (( INSCRIPT ++ )) 
>  command script "$@"
>  (( INSCRIPT -- ))
>}
>
>then when you set your prompt, test to see if $INSCRIPT is > 0.

Thanks for the response; however, a more insidious problem has reared
it's head: both the above and my former method (modified to zsh, of
course) does not work, since the forking of a subshell doesn't reread
the startup scripts when 'script' is executed.

I have been unsuccessful in figuring out why this seems to happen, as
the documentation I've read doesn't give a clue... anyone have any 
ideas on how to get around this little problem?


Ken Lareau
elessar@xxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author