/bin/sh does not read profile
Frank Shute
frank at shute.org.uk
Wed Mar 4 20:15:16 PST 2009
On Wed, Mar 04, 2009 at 04:08:03PM +0100, Bertram Scharpf wrote:
>
> Hi,
>
> from "man sh":
>
> Invocation
> [...] When first starting, the shell inspects
> argument 0, and if it begins with a dash (`-'), the shell is also consid-
> ered a login shell. This is normally done automatically by the system
> when the user first logs in. 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
Usually ~/.xinitrc is parsed by the X server when it starts (startx is
just a Bourne shell script) and you exec the last command (the window
manager) in your ~/.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.
E.g:
/bin/sh -c somecommand (login shell - arg 0 starts with a dash)
/bin/sh somecommand (not a login shell)
>
> I first wondered why none of my commands in "/etc/profile" and
> "~/.profile" got executed. Finally, I modified
> "/usr/src/bin/sh/main.c" to trace what files are read, recompiled
> the "sh" command and: the only file that is executed is "~/.shrc".
>
> I just cannot believe that FreeBSD has such a severe bug. What is
> going wrong here?
>
> Thanks in advance,
>
> Bertram
>
Regards,
--
Frank
Contact info: http://www.shute.org.uk/misc/contact.html
More information about the freebsd-questions
mailing list