From owner-freebsd-questions@FreeBSD.ORG Thu Mar 5 23:40:11 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 020EA10656CC for ; Thu, 5 Mar 2009 23:40:11 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 8B4968FC12 for ; Thu, 5 Mar 2009 23:40:10 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-196-109-64.dynamic.qsc.de [92.196.109.64]) by mx02.qsc.de (Postfix) with ESMTP id 0D66916C00E1; Fri, 6 Mar 2009 00:40:08 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n25Ne3Ex001572; Fri, 6 Mar 2009 00:40:03 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 6 Mar 2009 00:40:03 +0100 From: Polytropon To: Bertram Scharpf Message-Id: <20090306004003.99091e42.freebsd@edvax.de> In-Reply-To: <20090304150803.GA30617@marge.bs.l> References: <20090304150803.GA30617@marge.bs.l> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: /bin/sh does not read profile X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 23:40:11 -0000 Good evening Betram et al. I've read the discussion thread as far as it went and would like to share my own solution to a similar problem, mapped onto the sh topic. Maybe it works. A little background: First of all, because my standard dialog shell is the system's C shell, the files important are /etc/cshrc with the settings, such as setenv, alias and path, furthermore /etc/csh.login to be executed after login, and /etc/csh.logout, executed after logout. Local to the user exist ~/.cshrc, ~/.login and ~/.logout which are used if present. In order to make X work properly with these settings, I have a kind of "two stages mechanism" which consists of the files ~/.xinitrc and ~/.xsession. The first one is used by X (xdm) to determine what to do after successful user login, e. g. start some programs and then exec the window manager / desktop environment. Note that both files are chmodded executable: % ll .xsession .xinitrc -rwxr-xr-x 1 poly pgm 807 Mar 3 02:46 .xinitrc* -rwxr-xr-x 1 poly pgm 43 Apr 27 2006 .xsession* The ~/.xsession doesn't do anything besides first incorporate settings from ~/.cshrc and then execute ~/.xinitrc. #!/bin/csh source ~/.cshrc exec ~/.xinitrc It is shebanged with the shell I want to use, which is the C shell. If ~/.xsession is called, it's last action is to execute ~/.xinitrc. If ~/.xsession is NOT called, ~/.xinitrc will be executed anyway. It does the following: #!/bin/sh [ -f ~/.xmodmaprc ] && xmodmap ~/.xmodmaprc xrandr --size 1400x1050 & xrandr --fb 1400x1050 & xsetroot -solid rgb:3b/4c/7a # ... your initializations 'n stuff here ... exec wmaker Note that this script is shebanged for sh again. Any X terminals started now (with csh inside) have the settings from ~/.cshrc. Mapped onto the initial sh problem, I'd suggest to create the two files mentioned as follows: ~/.xsession: #!/bin/sh [ -f ~/.shrc ] && . ~/.shrc [ -f ~/.profile ] && . ~/.profile exec ~/.xinitrc ~/.xinitrc: #!/bin/sh [ -f ~/.shrc ] && . ~/.shrc [ -f ~/.profile ] && . ~/.profile my_init_stuff_1 my_init_stuff_2 my_init_stuff_3 exec my_wm_startup Now any instance of sh started should be aware of the settings. Finally, please note that I'm not a guru for sh (or bash) because I do use sh only for scripting, and bash never. :-) -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...