sh doesn't source /etc/profile after I log in - QNX 6.3

This is very strange. WHen I log into QNX I have noticed that it isn’t sourcing /etc/profile. That’s a bit of a problem since I need to add some customizations. So I tried creating .profile in my home directory and have it do a

. /etc/profile

so that it sources /etc/profile. Unfortunately after logging in I found that my .profile wasn’t sourced, either.

So what’s the deal with sh? I tried setting my shell to bash which made everything seem to source just fine. One problem: I couldn’t compile anymore - can’t find gcc when I’m running bash.

I’d prefer to run bash, but sh will do. But I’d like sh to work like it has elsewhere. Right now I’m not really sure what to do to get it sourcing /etc/profile.



Look in /etc/profile.d and copy all the files which end in *.sh so that they end in .bash and bash should work fine for you. Basically the /etc/profile script source anything which is in /etc/profile.d/.shellname - this is where the compile envars and such are setup.



nope, doesn’t work.

scratch that. It -did- finally work when I stuck in sourcing /etc/profile directly into my .bashrc, so now it picks up the /etc/profile.d scripts okay.

many thanks!

ah… You also have to add bash to phlogin so it knows to start bash as a login shell.

$ mkdir -p ~/.ph/login/shells
$ cat > ~/.ph/login/shells/bash

  • –login -c

and then logout and back in.

Rick “been there, done that…”

I tried your suggestion with creating the ~/.ph/login/shells/bash file as indicated, but it didn’t make any difference: When I log in, .bashrc is still unsourced. Of course all I have to do is

. .bashrc

as my first command and everything works, but I’d LOVE to figure out how to make this work automatically.

I imagine I’d also need one for the original Bourne shell, sh. Is that the case?


Look up phlogin in the help and read what it says. It already knows how to start the default shell as a login shell, so it doesn’t need help for that.

Perhaps the local (~/.ph/login/…) doesn’t work… There is also a mechanism to create a global once and I have both, so I am not sure which works. The local one “should” work. ;-)

If this doesn’t work, there is something wrong with your setup as I am using bash as described without any special treatment…


I’m going to be updating all the shell packages to populate the one in /etc so phlogin does the right thing. :slight_smile:

cool… I tried to get them to do that with the sdk during the beta but apparently that didn’t go too far… :frowning: