Forum Discussion
Altera_Forum
Honored Contributor
21 years agoProblem with /bin/sh profile
Another problem that has been puzzling me lately. I'm running the /bin/sh shell and I can't seem to pick up changes in the /etc/profile file. For referrence, here's the file I'm using (copied from another machine):
-------------------------------------------------------------------------------------# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). PATH="/usr/local/bin:/usr/bin:/bin" if [ "$PS1" ]; then if [ "$BASH" ]; then PS1='\u@\h:\w\$ ' else if [ "`id -u`" -eq 0 ]; then PS1='whoami# ' else PS1='whoami$ ' fi fi fi export PATH ------------------------------------------------------------------------------------- From what I can tell from messing around with /bin/sh, it doesn't appear to be reading the /etc/profile file. Is this something to do with uKit's uClinux port or something I'm missing? Ultimately, I'd just like to display the path in the prompt, but right now I'd settle for whoami. Thanks.2 Replies
- Altera_Forum
Honored Contributor
I'll poke around sometime today or tommorow and see if I can find out why it's give you problems.
- Altera_Forum
Honored Contributor
Thanks, although I might have figured it out.
It turns out I'm starting /bin/sh from the login program and not from inittab. So I had to change the login program to pass a '-' character otherwise /bin/sh won't read from /etc/profile. execl("/bin/sh", "/bin/sh", 0); Became execl("/bin/sh", "-/bin/sh", 0); Now I'm picking up settings in /etc/profile, but it doesn't appear that /bin/sh can handle variables. I've tried $PWD and \w to get a path into the prompt, but neither have worked. Oh well.