Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Shell Programming, Why Won't Setting Path Stick., shell programming.
post Nov 10 2003, 09:54 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 1
Joined: 10-November 03
Member No.: 1,783


I'm a Java programmer who's a newbe with RedHat (ver 9). To set up my environment I've written a very symple shell program to set the PATH and CLASSPATH. However, once the shell program has terminated none of the changes stick. For example PATH is the same as it was before running the program. What the heck is going on??? Please tell, I've done this a zillion times on the iSeries and pSeries and the changes stayed. Here is a copy of what I'm talking about. I'm sure its something simple and easy, but man, I'm lost. Thanks

listing of my shell program.

-rwxrwxrwx 1 ferris ferris 40 Oct 22 20:46

[ferris@localhost java]$ head
export JAVA_HOME=":/usr/java/j2sdk1.4.2_02/bin/"
echo $PATH

here is my before PATH

[ferris@localhost java]$ echo $PATH

here I run the shell program and you can see the PATH has changed.

[ferris@localhost java]$ ./

now here is the PATH afterwards. As you can see, it does change in the program does not stick, its the same.

[ferris@localhost java]$ echo $PATH
[ferris@localhost java]$

Nothing sticks at this point, no PATH, no CLASSPATH not even JAVA_HOME.
Go to the top of the page
+Quote Post
post Nov 11 2003, 09:16 AM
Post #2

Its GNU/

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151

You have to export any variables that you want to stay after the script is the variable JAVA_HOME should be there after you are finished running the script ... do the command:

env | grep JAVA_HOME

and see if it stays...

Change the script like this:


or this


and you should be OK ... also get rid of the : in front of $JAVA_HOME if you are going to put it in the front of path...

Johnny Hughes
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 20th June 2018 - 06:52 AM