vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I just modified the S99Local in the /rc.d and want to explore the CLASSPATH into enviroment. Tried several times, I found after S99Local executed, the CLASSPATH still not be added. I have two questions here: 1. Is there any other files executed after S99Local. I think S99Local should be the last step in startup linux. 2. Why I use shell script can not add CLASSPATH? The script is like: export CLASSPATH=/opt/j2ee/... exit 0 but if I use command line, ex. $export CLASSPATH=/opt/j2ee/... , it works. I use RH9. Any suggestion. Steven |
| |||
| steven wrote: > Hi, > > I just modified the S99Local in the /rc.d and want to explore the > CLASSPATH into enviroment. You want to what? What does "explore the CLASSPATH into enviroment" actually mean? > > Tried several times, I found after S99Local executed, the CLASSPATH > still not be added. An "export" within a shell script will not have any effect on its parent shell environment. > > I have two questions here: > > 1. Is there any other files executed after S99Local. I think S99Local > should be the last step in startup linux. > 2. Why I use shell script can not add CLASSPATH? > The script is like: > export CLASSPATH=/opt/j2ee/... > exit 0 You cannot do it this way. The export does not affect the parent of the shell. Why don't you run a test? Like this: $ test="original test" $ sh (child shell) $ test="child test";export test (child shell) $ exit $ echo $test original test > > but if I use command line, ex. $export CLASSPATH=/opt/j2ee/... , it > works. > > I use RH9. > > Any suggestion. What are you trying to do? Please state the problem, not your idea of a solution. And why not run some simple tests? -- Paul Lutus http://www.arachnoid.com |
| ||||
| steven <yu271637@yorku.ca> wrote: > I just modified the S99Local in the /rc.d and want to explore the > CLASSPATH into enviroment. > > Tried several times, I found after S99Local executed, the CLASSPATH > still not be added. I think you mean 'export' and not 'explore'. The reason for the behaviour you experienced is that S99Local is executed in a subshell (see 'man bash', section COMMAND EXECUTION) since it is not sourced (see 'man bash', section SHELL BUILTIN COMMANDS, command 'source'). Put the CLASSPATH in /etc/profile if it should apply to all users and commands and in .bash_profile if it should apply to a single user (see 'man bash', sections INVOCATION and FILES). Yours, Laurenz Albe |