From owner-freebsd-questions@FreeBSD.ORG Mon Aug 23 03:08:49 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB1E416A4CE for ; Mon, 23 Aug 2004 03:08:49 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id A746D43D1F for ; Mon, 23 Aug 2004 03:08:49 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.11/8.12.11) id i7N38moF043829; Sun, 22 Aug 2004 22:08:48 -0500 (CDT) (envelope-from dan) Date: Sun, 22 Aug 2004 22:08:48 -0500 From: Dan Nelson To: Gary Kline Message-ID: <20040823030848.GA70547@dan.emsphone.com> References: <20040822224148.GA60895@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040822224148.GA60895@thought.org> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: FreeBSD Mailing List Subject: Re: How can I tell if I'm ssh'd into a host? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2004 03:08:50 -0000 In the last episode (Aug 22), Gary Kline said: > This is a strange one. On different hosts in my ~/.zlogin, I test > for `hostname` = HOST.thought.org > > If true, I do certain things such as set xhost FOO and xmodmap > ~/.xmodmaprc... I've noticed that with my 5-CURRENT on my laptop, I > get complains from xhost and naturally, xmodmap. > > Is there a way of asking where I am on the console/KVM, or remote and > ssh'd? Sorry if I''m not explaining this well. --I didn't notice > these complains when I had 4.10 on my laptop. Aside from having > .zlogin prompt: "Are you ssh'd in? [y/[n]] " I'm drawing a blank. It sounds like you really want to know whether you're running under X or not, since you mention xhost errors. If you ssh in from a console login, xhost/xmodmap will still complain :) You can test to see if $DISPLAY is set to see whether you're connecting from an X session. if [ $+DISPLAY -eq 1 ] ; then # do X stuff fi -- Dan Nelson dnelson@allantgroup.com