Results 1 to 2 of 2
Hi,
This is a script that should set and add some path to some variables:
Code:
[root@skynet script]# cat XSB.sh
#!/bin/sh
XSB_PATH=/app/XSB
export XSB_PATH
XSB_CONF_PATHNAME=$SERVICEBROKER_PATH/cfg/XSB.cfg
export XSB_CONF_PATHNAME
PATH=$PATH:$XSB_PATH/bin
export PATH
...
- 03-31-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 30
Adding my app path to PATH variable - not working
Hi,
This is a script that should set and add some path to some variables:
Do you have any idea why my app path is not added ?Code:[root@skynet script]# cat XSB.sh #!/bin/sh XSB_PATH=/app/XSB export XSB_PATH XSB_CONF_PATHNAME=$SERVICEBROKER_PATH/cfg/XSB.cfg export XSB_CONF_PATHNAME PATH=$PATH:$XSB_PATH/bin export PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$XSB_PATH/lib export LD_LIBRARY_PATH [root@skynet script]# ./XSB.sh [root@skynet script]# echo $XSB_CONF_PATHNAME [root@skynet script]# echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
Thanks,
BiancaLast edited by devils casper; 03-31-2008 at 12:08 PM.
- 03-31-2008 #2Sure.Do you have any idea why my app path is not added ?
Every process that you run has a parent process, the process that started the process in question. When a process starts, it (almost always) inherits the values of the environment variables of the parent. That process is free to change the values of those environment variables, but when the process finishes, any changed values do not cause the corresponding environment variables in the parent to change.
When you run your script thus:
that script is run in a new process. When that script is done, the process goes away. The environment changes in that process do not take effect in the parent process. (In this case, the parent process is the one running your shell at the command line.)Code:./XSB.sh
What you want is to run that shell script as part of your current process. One way is this:
Another way to "spell" that has exactly the same effect:Code:source ./XSB.sh
Note the extra period and space at the beginning.Code:. ./XSB.sh
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote