We see a flashback to when Kagami lived in the US in episode 1 of season 2 (26Q). 



Judging from all the palm trees, I'd hazard a guess that he was probably in California. California also seems like the most likely option on a demographic basis (i.e. where are Japanese temporary immigrants most likely to end up?).

Is it ever explicitly stated where he lived? And if it is California, is it ever stated whether he's in SoCal or NorCal (or somewhere else)?


Question: No value for $TERM and no -T specified
Answer: What ultimately worked for me was to check whether the shell was an interactive shell.  I based the solution on this other post at unix.stackexchange: How to check if a shell is login/interactive/batch.

So the code for the solution was:

if [[ $- == *i* ]]; then
  fgRed=$(tput setaf 1)     ; fgGreen=$(tput setaf 2)  ; fgBlue=$(tput setaf 4)
  fgMagenta=$(tput setaf 5) ; fgYellow=$(tput setaf 3) ; fgCyan=$(tput setaf 6)
  fgWhite=$(tput setaf 7)   ; fgBlack=$(tput setaf 0)
  bgRed=$(tput setab 1)     ; bgGreen=$(tput setab 2)  ; bgBlue=$(tput setab 4)
  bgMagenta=$(tput setab 5) ; bgYellow=$(tput setab 3) ; bgCyan=$(tput setab 6)
  bgWhite=$(tput setab 7)   ; bgBlack=$(tput setab 0)
fi