From owner-freebsd-hackers@FreeBSD.ORG Sat Sep 28 16:39:32 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9F79CD09; Sat, 28 Sep 2013 16:39:32 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2244B255E; Sat, 28 Sep 2013 16:39:32 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.16]) by ltcfislmsgpa07.fnfis.com (8.14.5/8.14.5) with ESMTP id r8SGdTZQ020106 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sat, 28 Sep 2013 11:39:31 -0500 Received: from LTCFISWMSGMB21.FNFIS.com ([169.254.1.202]) by LTCFISWMSGHT05.FNFIS.com ([10.132.206.16]) with mapi id 14.02.0309.002; Sat, 28 Sep 2013 11:36:04 -0500 From: "Teske, Devin" To: "sbruno@freebsd.org" Subject: Re: Trying to use /bin/sh Thread-Topic: Trying to use /bin/sh Thread-Index: AQHOvGjSXYG50pxOjUqfcBB22CroTA== Date: Sat, 28 Sep 2013 16:36:03 +0000 Message-ID: <13CA24D6AB415D428143D44749F57D720FC05A80@LTCFISWMSGMB21.FNFIS.com> References: <1380309632.84323.3.camel@localhost> <20130927221459.GA27990@stack.nl> <52468F62.6010404@freebsd.org> In-Reply-To: <52468F62.6010404@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.132.253.121] Content-Type: text/plain; charset="us-ascii" Content-ID: <3CCC4B8D7A6627478CFBBF0EB894C4DC@fisglobal.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-09-28_02:2013-09-27,2013-09-28,1970-01-01 signatures=0 Cc: FreeBSD Hackers , Devin Teske X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2013 16:39:32 -0000 On Sep 28, 2013, at 1:12 AM, Stefan Esser wrote: > Am 28.09.2013 00:14, schrieb Jilles Tjoelker: >> sh's model of startup files (only login shells use startup files with >> fixed names, other interactive shells only use $ENV) assumes that every >> session will load /etc/profile and ~/.profile at some point. This >> includes graphical sessions. The ENV file typically contains only shell >> options, aliases, function definitions and unexported variables but no >> environment variables. >>=20 >> Some graphical environments actually source shell startup files like >> ~/.profile when logging in. I remember this from CDE for example. It is >> important to have some rule where this should happen to avoid doing it >> twice or never in "strange" configurations. As a workaround, I made >> ~/.xsession a script interpreted by my login shell and source some >> startup files. A problem here is that different login shells have >> incompatible startup files. >=20 > I used to modify Xsession to do the final exec with a forced login > shell of the user. This worked for users of all shells. >=20 > The script identified the shell to use and then used argv0 to start > a "login shell" to execute the display manager. >=20 > A simplified version of my Xsession script is: >=20 > ------------------------------------------------------------------ > #!/bin/sh >=20 > LIB=3D/usr/local/lib >=20 > SH=3D$SHELL > [ -n "$SH" ] || SH=3D"/bin/sh" > SHNAME=3D`basename $SH` >=20 > echo "exec $LIB/xdm/Xsession.real $*" | \ > /usr/local/bin/argv0 $SH -$SHNAME > ------------------------------------------------------------------ >=20 > The argv0 command is part of "sysutils/ucspi-tcp", BTW. >=20 > This script prepends a "-" to the name of the shell that is > started to execute the real "Xsession", which had been renamed > to Xession.real. >=20 > I know that the script could be further simplified by using "modern" > variable expansion/substitution commands, but this script was in use > some 25 years ago on a variety of Unix systems (SunOS, Ultrix, HP-UX) > and I only used the minimal set of Bourne Shell facilities, then. >=20 > You may want a command to source standard profiles or environment > settings before the final exec, in case the users shell does not > load them. >=20 In my ~/.fvwm2rc file, this is how I launch an XTerm. This achieves the goal of sourcing my profile scripts like a normal login shell while launchi= ng XTerm(s) in the GUI. DestroyFunc FvwmXTerm AddToFunc FvwmXTerm PipeRead '\ cmd=3D"/usr/bin/xterm"; \ [ -x "${cmd}" ] || cmd=3D"/usr/X11R6/bin/xterm"; \ [ -x "${cmd}" ] || cmd=3D"xterm"; \ cmd=3D"${cmd} -sb -sl 400"; \ cmd=3D"${cmd} -ls"; \ cmd=3D"${cmd} -r -si -sk"; \ cmd=3D"${cmd} -fn \\"-misc-fixed-medium-r-*-*-15-*\\""; \ echo "+ I Exec exec ${cmd}"' Essentially producing an XTerm invocation of: xterm -sb -sl 400 -ls -r -si -sk -fn "-misc-fixed-medium-r-*-*-15-*" And everytime I launch an XTerm with that, I get my custom prompt set by ~/.bash_profile. Of course, I'm also a TCSH user, so when I flop over to tcsh, I also get my custom prompt set by ~/.tcshrc But failing that... you could actually make your XTerm a login shell with: xterm -e login But of course, then you're looking at having to enter credentials. Perhaps it's just a matter of getting your commands into the right file... .bash_profile for bash and .tcshrc for tcsh. --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you.