Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2016 23:48:29 -0400
From:      Anton Yuzhaninov <citrin+bsd@citrin.ru>
To:        freebsd-questions@freebsd.org
Subject:   Re: Interesting $0 Problem
Message-ID:  <5b07633f-3241-27a5-15fc-1c138a3083d8@citrin.ru>
In-Reply-To: <2b1b598d-2ff1-2fa4-03d1-4771aa6f9c4d@tundraware.com>
References:  <b859f7a3-51d1-06f4-e793-332edd212068@tundraware.com> <20161028014923.GA11638@fedora24> <a6931603-c2b2-1dc7-6997-ae896db90d88@tundraware.com> <5812B617.5070701@gmail.com> <27078.128.135.52.6.1477621835.squirrel@cosmo.uchicago.edu> <20161028024041.GA93243@spectrum.skysmurf.nl> <2b1b598d-2ff1-2fa4-03d1-4771aa6f9c4d@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 10/27/16 22:44, Tim Daneliuk wrote:
> I've used *BSD for decades and this is a new one to me.  I've never seen
> this behavior anywhere else (like Linux).  Do you have some sense of the
> rationale' for this?

It is very old Unix convention - argv[0] for login shells is prefixed by 
"-".

 From AT&T UNIX SRV2 (released in April, 1984):

file /src/cmd/login.c

char    minusnam[16] = "-";

...

/*      Generate the name of the shell with a '-' sign in front of it.  */
/*      This causes .profile processing when a shell is exec'ed.        */

         strcat(minusnam, namep);




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5b07633f-3241-27a5-15fc-1c138a3083d8>