I want to change the color scheme to red when someone logs into the prod system. I achieved this by querying our central repository for prod servers and updating .kshrc as below -
host=hostname
...
...
search string using $hostname
env will be set to 1 if the server is prod
if [[ $env = 1 ]] then tput setaf 7 tput setab 1 clear else tput setaf 7 tput setab 4 clear fi
This works fine when I am remote login to prod and then again remote login to another non-prod. But problem is when I for example login to a prod system from a non prod the color scheme changes to red as expected , however, if I use ctrl+d to logout the color scheme doesn't change even though I am now logged out in the non-prod system. Any suggestions, on how SIGQUIT (ctrl+d) can be trapped and used for color change?