Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following /etc/environment:

export PATH=$PATH

Whenever I log in I get the following errors:

-bash: id: command not found
-bash: tty: command not found

What am I doing wrong?

(my actual /etc/enviroment is more complicated and sets up java onto the path but for simplicity I cant even get the above to work)

I'm using Centos6

share|improve this question
2  
what makes you think the two are related? –  stew May 16 '12 at 11:41
    
Please could you add more detail. What makes you believe that $PATH had anything useful in before you assigned it to $PATH and exported it? –  Sirch May 16 '12 at 11:41
    
@stew because I dont get that error without that line. –  DD. May 16 '12 at 14:17

2 Answers 2

I think the cleaner approach is to use an entry in /etc/profile.d over /etc/environment, but can you echo the output of $PATH? That may be the real issue. Or at least show the complicated environment file's details.

share|improve this answer
    
Apparently /etc/environment is for system wide variables..help.ubuntu.com/community/… –  DD. May 16 '12 at 14:21
    
@DD. While that may be the case, CentOS/RHEL may be using it differently. /etc/environment is rather integral to my Ubuntu boxes, but it's an empty file in my stock CentOS units. –  Magellan May 16 '12 at 16:02

This sounds like a quoting problem (i.e. the current value of $PATH contains IFS characters and bash is trying to execute some part of it). Variable values should almost always be quoted, so that line should look like:

export PATH="$PATH"

However, since you're not changing the value of $PATH you don't actually need the assignment, and the following is sufficient:

export PATH
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.