export Warnings/Errors at Bash Login - How to trace down issues?
We are getting
-bash: export: `/usr/java/default': not a valid identifier messages when we login as root to one of our server. This started occurring after a consultant installed software on the server. I have looked around in .bashrc, etc. for the error path so I can remove it, but can't seem to locate it. Does anyone have any tips on how to locate script line where this is being included, and/or trace the login procedure to find the culprit? |
Look for a line
Code:
export $<something> |
Quote:
Different files are used for logon, interactive and non-logon bash sessions so you can home in on the problem line by considering if it happens only for logon sessions. If that isn't enough, you can add a line at the beginning and end of each start up file, something like Code:
echo '.bashrc starting' Another technique is to put set -xv in the startup files; doing so in the global files (under /etc) will affect all users. Doing so in any start up file may cause breakage. So better to do so in the user's own bash start up file(s) first! |
If you don't want to modify anything you could just run
Code:
bash -x ~/.bashrc But, for the look of it, I think that you are either missing the left-most part of a variable declaration. It should usually look like this: Code:
VAR="value" Code:
export /whatever/value |
Thinking about it, your problem might be something more like this:
Code:
VAR=/my/value |
On further reflection this might be a simpler way to track down the offending line:
Code:
grep '/usr/java/default' /etc/profile ~/.bash_profile ~/.bash_login ~/.profile /etc/profile.d/*.sh |
Quote:
Heh. Which is pretty much what I said in less words ;D |
Catkin thanks for that link to "Bash's use of Bash Startup Files". That was the tip I needed to locate the /etc/profile and remove 2 export statements that were causing the problem. Thanks to everyone else for the additional information.
Jaye |
All times are GMT -5. The time now is 07:58 AM. |