2009-03-11 11:31:44 permanently setting shell variables
ian davidson (UNITED KINGDOM)
Message: 70781
An easy one....
How do I add environment variables to my shell so that whenever I login the environment vars are set.
Specifically I want to add directories to $PATH, want to add the current directory to it.
I have changed the file /etc/rc and added esport PATH=$PATH:.
does not work.
putting this line in /etc/profile, /etc/.profile /etc/bash.bashrc does not work either.
Where does busy box get these env vars from?
Here is "version" and "set"
Many thanks,
ian davidson
root:/> version
kernel: Linux release 2.6.22.19-ADI-2008R1.5-svn, build #81 Wed Mar 11 15:19:04 GMT 2009
toolchain: bfin-uclinux-gcc release gcc version 4.1.2 (ADI svn)
user-dist: release 2008R1.5, build #73 Wed Mar 11 15:19:22 GMT 2009
root:/> set
PS2=>
PS1=\u:\w>
IFS=
HOME=/
SHELL=/bin/sh
PATH=/bin:/usr/bin:/etc:/sbin:/usr/sbin
TCPLOCALPORT=23
TCPREMOTEPORT=2429
TCPREMOTEIP=172.16.0.48
TCPLOCALIP=172.16.8.6
PROTO=TCP
root:/>
==========================================
/bin/sh is a sym link to /bin/busybox
QuoteReplyEditDelete
2009-03-11 11:45:25 Re: permanently setting shell variables
Mike Frysinger (UNITED STATES)
Message: 70783
please read the documentation:
http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:shell
QuoteReplyEditDelete
2009-03-11 14:02:54 Re: permanently setting shell variables
ian davidson (UNITED KINGDOM)
Message: 70791
Thanks for your reply.
I've tried that but it still does not work, makes me wonder if we are running a login shell at all:
/etc/inittab
root:/etc> cat inittab
# inittab for uClinux
# Format:
# ttyline:termcap-entry:getty-command
#inet:ttyS0:/bin/inetd
#httpd:unknown:/bin/httpd
#sh:unknown:/bin/sh
#ttyS0::respawn:-/bin/sh
#sh:console:respawn:/bin/sh
console::askfirst:-/bin/sh
slog:unknown:/sbin/syslogd -n
klog:unknown:/sbin/klogd -n
root:/etc>
/etc/profile
root:/etc> cat profile
export PATH=$PATH:.
echo running /etc/profile
root:/etc>
/.profile
root:/> cat .profile
echo running /.profile
export PATH=/bin:/usr/bin:/etc:/sbin:/usr/sbin:/myplace
root:/>
Yet when I telnet to the target PATH is unchanged.
I added the /etc/profile and /.profile files after the target had booted up, but the /etc/inittab was built into the kernel rootfs.
do I have to change the kenel build?
Thanks,
ian
QuoteReplyEditDelete
2009-03-11 14:10:03 Re: permanently setting shell variables
Mike Frysinger (UNITED STATES)
Message: 70792
telneting to the board does not start a login shell by itself by default. you can either enable the normal login binary or edit sys_term.c so it launches a login shell.