Environment variable not being read

1

1

I am running Ubuntu 12.04.2 LTS and am having problems with getting a command to execute. I have set up the variable in /etc/environment which looks like this:

FEDORA_HOME="/var/lib/fedora"
CATALINA_HOME="/var/lib/tomcat6"
ORACLE_HOME="/usr/lib/oracle/11.2/client64"
JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=128m - Djavax.net.ssl.trustStore=/usr/local/fedora/truststore -Djavax.net.ssl.trustStorePassword=tomcat"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$FEDORA_HOME/server:$FEDORA_HOME/client/bin:$ORACLE_HOME:$ORACLE_HOME/bin"

The issue is with the $ORACLE_HOME in the PATH variable. I can cd to the correct directory using:

cd $ORACLE_HOME/bin

But when I try to run sqlplus (the program I am having problems with), the system can't find it. And before anyone asks, yes I have rebooted the system and the file sqlplus does exist in $ORACLE_HOME/bin and is executable by everyone.

This should work, but obviously isn't. Any ideas as to what the issue might be? It is like it doesn't exist in the path although it is clearly there. I can't figure this out. Please help!

Thanks

user5013

Posted 2013-03-20T23:28:20.640

Reputation: 155

You cannot use variables in /etc/environment. – wisbucky – 2019-04-18T16:54:08.737

Answers

1

The Ubuntu docs say that the environment file isn't a script file, so it may not be interpreting your $ORACLE_HOME variable the way you hope. Run env to see what your path looks like. If it isn't what you expect, try hard coding the full path in /etc/environment and see if that helps.

kjw0188

Posted 2013-03-20T23:28:20.640

Reputation: 126

Hard coding the path worked! Thanks. I thought you could put in variable names into the path as I have seen numerous how to manuals that say to do that. – user5013 – 2013-03-21T15:55:25.720

If you edit your ~/.profile instead of your etc/environment, then you can use variables. However, the path will only be set for your user. If this answer helped you, please consider accepting it. – kjw0188 – 2013-03-21T17:35:46.403

0

There are two probable reasons:
1) $PATH isn't set
2) There's conflicting sqlplus earlier in the PATH.

To make sure path is set, run echo $PATH from console. It should print /usr/lib/oracle/11.2/client64 among other paths.

Also I recommend to put $ORACLE_HOME:$ORACLE_HOME/bin before other paths.

If nothing works, make sure sqlplus is directly runnable:
cd /usr/lib/oracle/11.2/client64
./sqlplus
Maybe it's a script pointing to non-existent shell?

Mikhail Kupchik

Posted 2013-03-20T23:28:20.640

Reputation: 2 381