On Sun, Jan 21, 2007 at 11:42:33PM -0500, Cecil wrote:
> I have a problem understanding the syntax for setting the classpath
> variable. Why is the classpath set in this
> manner--->('CLASSPATH=$CLASSPATH:.').
The above means: append the current directory (``.'') to the variable
CLASSPATH. The ``$CLASSPATH'' expands to the current value of
CLASSPATH and then the ``:.'' appends a single value to it.
> Why is the variable-identifier $CLASSPATH used with the single
> ('.'), and should it include the
> following:/usr/local/jdk1.5.0_10/src.zip:/usr/local/jdk1.5.0_10/lib/dt.jar
> :/usr/local/jdk1.5.0_10/lib/tools.jar:/usr/local/jdk1.5.0_10/lib/htmlconverter.jar
> :/usr/local/jdk1.5.0_10/jre/lib/charsets.jar:/usr/local/jdk1.5.0_10/jre/lib/deploy.jar
> :/usr/local/jdk1.5.0_10/jre/lib/rt.jar; export CLASSPATH
So if CLASSPATH was
/usr/local/jdk1.5.0_10/src.zip:/usr/local/jdk1.5.0_10/lib/dt.jar
Then it would be this after the above statement
/usr/local/jdk1.5.0_10/src.zip:/usr/local/jdk1.5.0_10/lib/dt.jar:.
As for ``export CLASSPATH'', that makes a variable and environment
variable (passed from parent process to child process). In most
modern shells, e.g. bash, once you export a variable, any changes you
make to it are also exported. So this is legal (but may not be
considered transferable to old Bourne shells):
CLASSPATH=foo
export CLASSPATH
CLASSPATH=$CLASSPATH:bar
--
David Dooling
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/