in the bashrc file i was sourcing multiple other files. and it turned
out to be an xkeymap call that caused the message. Turns out the x in
xkeymap is for... -x
You can test whether a console login is via SSH or not like this
if [[ $(who -m) =~ \([-a-zA-Z0-9\.]+\)$ ]] ; then
echo "SSH session"
else
echo "not SSH session"
fi
who -m
produces hostname and user associated with stdin, and in an SSH shell there is output, and none in a GUI terminal, which we can test for. who
plus two dummy arguments will produce the same effect, e.g. who am i
(very popular), who mom likes
or who a b
etc.
The top grab is my Rpi4 GUI, the bottom is an SSH login from my Windows PC using wsltty.