From owner-freebsd-questions@freebsd.org Fri Oct 28 16:02:05 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E81A4C25D9D for ; Fri, 28 Oct 2016 16:02:05 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from bede.qeng-ho.org (bede.qeng-ho.org [217.155.128.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fileserver.home.qeng-ho.org", Issuer "fileserver.home.qeng-ho.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DCB4BBB for ; Fri, 28 Oct 2016 16:02:04 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from arthur.home.qeng-ho.org (arthur.home.qeng-ho.org [172.23.1.2]) by bede.home.qeng-ho.org (8.15.2/8.15.2) with ESMTP id u9SG222w024250; Fri, 28 Oct 2016 17:02:02 +0100 (BST) (envelope-from freebsd@qeng-ho.org) Subject: Re: Interesting $0 Problem To: Tim Daneliuk , FreeBSD-Questions References: <516bc76f-f14c-e9a5-a246-2e915a5369ce@qeng-ho.org> <5a4f0424-cdfa-bd44-9de2-b4860d121584@tundraware.com> From: Arthur Chance Message-ID: <06dacace-e46a-9437-4fa6-ab4d1ea9a2a0@qeng-ho.org> Date: Fri, 28 Oct 2016 17:02:02 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5a4f0424-cdfa-bd44-9de2-b4860d121584@tundraware.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2016 16:02:06 -0000 On 28/10/2016 15:40, Tim Daneliuk wrote: > On 10/28/2016 03:34 AM, Arthur Chance wrote: > > >> >> >> Prepending a dash to a login shell has been standard behaviour since the >> BSD days at least. I think it was in version 6 of the original Bell Labs >> Unix as well, but after three and a half decades my memories for such >> details are a bit hazy. Anyway, it's a standard marker. >> > > > Thanks to all who took the time to answer what turned out to be a really > stupid question on my part. It's odd that I've never run into this > in over 3 decades of working on *NIX ... > > So now, can someone perhaps answer a couple of other really dumb questions: > > When is it useful for a script to know it's running in a login context vs. > a child of the login shell? When you want to automatically fire up ssh-agent or X or screen/tmux, or any other program that only makes sense to start once per login. > Is there another way to determine if your current shell is the login shell? csh/tcsh sets the variable loginsh only in login shells. I don't believe sh does anything special. > This is more intellectual curiosity than anything ... Nothing wrong with intellectual curiosity. It's the people without it I have problems with. :-) -- Schrödinger's cat had 18 half lives.