Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2009 16:52:12 +0000
From:      Frank Shute <frank@shute.org.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: /bin/sh does not read profile
Message-ID:  <20090305165212.GA36902@melon.esperance-linux.co.uk>
In-Reply-To: <20090305132352.GA8574@marge.bs.l>
References:  <20090304150803.GA30617@marge.bs.l> <20090305041505.GA35138@melon.esperance-linux.co.uk> <20090305132352.GA8574@marge.bs.l>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 05, 2009 at 02:23:52PM +0100, Bertram Scharpf wrote:
>
> Hi Frank,

Hi Bertram,

> 
> Am Donnerstag, 05. Mär 2009, 04:15:05 +0000 schrieb Frank Shute:
> > On Wed, Mar 04, 2009 at 04:08:03PM +0100, Bertram Scharpf wrote:
> > > from "man sh":
> > > 
> > >    Invocation
> > >      [...]  the shell inspects
> > >      argument 0, and if it begins with a dash (`-'), the shell is also consid-
> > >      ered a login shell.  [...] A login shell first reads commands from the
> > >      files /etc/profile and then .profile in a user's home directory, if they
> > >      exist.  [...]
> > > 
> > > I use Slim (X login manager) which calls
> > > 
> > >   exec /bin/sh - ~/.xinitrc
> > 
> > I've never before seen the syntax you've used and I think it comes
> > from a misunderstanding of the manpage for sh and/or it's a bashism or
> > a typo.
> 
> It's the original FreeBSD port.

I suggest you take up your problem with the maintainer. (Mentioned at
top of /usr/ports/x11/slim/Makefile). It should "just work" if that's
the case.

> 
> > E.g:
> > 
> > /bin/sh -c somecommand     (login shell - arg 0 starts with a dash)
> 
> Sorry, this doesn't call /etc/profile either.

You're right. This is what my investigations reveal:

$ /bin/sh date
date: Can't open date: No such file or directory

Not reading /etc/profile or ~/.profile

$ /bin/sh -c date
Thu Mar  5 16:33:17 GMT 2009

Reading ~/.profile but not /etc/profile

I'm afraid I'm not a shell guru so I don't understand that particular
weirdness. I think we need a shell wizard to explain it to us - these
shells and sub-shells etc. are notoriously weird in my experience and
half the time I just sacrifice goats to make it work.

It could be that the manpage is wrong and the shell is just meant to
read ~/.profile (or I'm reading it wrong).

If nobody replies on this list, I suggest you post with your problem
to hackers@

> 
>   $ uname -v
>   FreeBSD 7.1-RELEASE #0: Thu Jan  1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC

$ uname -v
FreeBSD 7.1-RELEASE-p2 #0: Wed Jan 28 21:45:37 GMT 2009
root@orange.esperance-linux.co.uk:/usr/obj/usr/src/sys/ORANGE_MP2

BTW, my user shell is ksh.

> 
> Bertram
> 

Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090305165212.GA36902>