View Full Version : bash and .bashrc
genericuser
08-01-2002, 01:29 AM
A while back my .bashrc stopped running on bootup. It was not a big deal, but I am trying to fix it and it is causing me pain.
In my rc.sysinit I have:
/bin/bash < /dev/ttyS3 >& /dev/ttyS3 &
I swear this used to execute my /.bashrc
In my / area I have the following:
-rwxr-xr-x 1 0 0 797 Dec 29 2001 .bashrc
It is executable and it contains my stty sane and the stty 57600. It would be nice for it to execute on bootup.
The first few lines of the .bashrc are:
stty 57600
stty sane
PS1="\w\\$ "
# TERM=ansi
alias ls='ls --color -l'
Does it need some sort of #! header as the first line????
I have tried changing the rc.sysinit line to both:
exec < /dev/ttyS3 >& /dev/ttyS3; bash --login
AND
/bin/bash --login < /dev/ttyS3 >& /dev/ttyS3 &
In oreder to try and force the execution of the /.bashrc but that does not help. I still have to dot in the /.bashrc onve I have teraterm up and running.
This system is a t-60 that has been 2.5xtremed.
Has anyone else seen this problem or know the fix??
Thanks
dtvwxyz
08-01-2002, 10:30 AM
I had the same problem, but never figured out why (probably dinged something remapping io). What worked for me was "cp .bashrc /etc/profile". Bash looks for /etc/profile first I beleive.
genericuser
08-01-2002, 12:06 PM
Ahhh..... Yes.... It would read the global startup file first. Great idea! Ok, I will give it a whirl and report back. Thanks for the idea.
arthur
08-02-2002, 02:05 AM
thank you
I had the same damn problem and couldn't get it to work
It would be nice if a mod could put this in the howto for everyone to benfit.
Thank you.
PS: I noticed that you are using --color for ls
where's the resource file for the colors?
I'd like to change the light green for the executables, it's kind of unreadable on lemon chiffon background.
Thanks
genericuser
08-02-2002, 10:17 AM
I did not get a chance to mess around last night. Just as I was going to start, my tivo froze and I am now restoring a backup to it. So I am bummed.
The weird part was I lost the /etc directory. Something went wrong with the drive. Time to invest in a fan, I think.
Oh yeah... I did notice after the resore of my 2.5 image that there is already a /etc/profile file. So I am not certain if there is anything in there you would want to keep. Check it out before simply overwriting it.
dtvwxyz
08-02-2002, 11:28 AM
I don't remember having an /etc/profile, perhaps "cat /.bashrc >> /etc/profile" would be better. Was /etc/profile added in Kraven's upgrade?
genericuser
08-03-2002, 11:03 AM
I am not certain where that /etc/profile cames from. I have not added Kraven's update or AlphaWolf's enhancement. Somehow I did add the /devbin area, so I wonder if it came in that.
Ok, so I have been messing around this morning since I have been rebuilding the tivo drive from scratch (ugh... dont ask, its a long story). I have discovered some interesting things... YMMV
A side note. Originally my /.bashrc was very short:
stty 57600
stty sane
PS1="\w\\$ "
# TERM=ansi
alias ls='ls --color -l'
Once I added vi, there is a whole new .bashrc that is provided and I appended that one to the /.bashrc I describe above. That is when the /.bashrc no longer executed on bootup.
If the rc.sysinit contains the following line to start bash:
/bin/bash < /dev/ttyS3 >& /dev/ttyS3 &
firstly /etc/profile is not read. The only way I can get /.bashrc to run is to leave the /.bashrc small as described above. Then as the last line of the /.bashrc I put in:
. /var/hack/.bashrc
The /var/hack/bashrc contains the .bashrc from the vi .zip file. At that point, everything works wonderfully.
If the rc.sysinit starts bash thusly:
/bin/bash --login < /dev/ttyS3 >& /dev/ttyS3 &
Then the following happens. Firstly, the /etc/profile is read. I put my original full /.bashrc (cat /.bashrc /var/hack/.bashrc > /etc/profile ; chmod 755 /etc/profile ; mv /.bashrc /bashrc.new) into the /etc/profile. This full bash startup file was executed.
If there is no /etc/profile in this setup, the /.bashrc is not executed either. I would suspect that the typical /etc/profile would dot in the /.bashrc as it's last action.
whew...
Long ass story shortened. It seems to me that people should use the --login form of the bash activation in their rc.sysinit file and the make all their changes in /etc/profile.
BTW: help for bash can be seen by starting with /bin/bash --help. From there is gets hairy fast.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.