Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2016 17:02:02 +0100
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        Tim Daneliuk <tundra@tundraware.com>, FreeBSD-Questions <freebsd-questions@freebsd.org>
Subject:   Re: Interesting $0 Problem
Message-ID:  <06dacace-e46a-9437-4fa6-ab4d1ea9a2a0@qeng-ho.org>
In-Reply-To: <5a4f0424-cdfa-bd44-9de2-b4860d121584@tundraware.com>
References:  <b859f7a3-51d1-06f4-e793-332edd212068@tundraware.com> <516bc76f-f14c-e9a5-a246-2e915a5369ce@qeng-ho.org> <5a4f0424-cdfa-bd44-9de2-b4860d121584@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28/10/2016 15:40, Tim Daneliuk wrote:
> On 10/28/2016 03:34 AM, Arthur Chance wrote:
> <SNIP>
> 
>>
>>
>> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06dacace-e46a-9437-4fa6-ab4d1ea9a2a0>