.bash_profile script

Michael Torrie torriem at chem.byu.edu
Tue Jun 6 22:40:54 MDT 2006


On Tue, 2006-06-06 at 21:19 -0600, Russel Caldwell wrote:
> Hi,
> Can somebody give me a shell script that will load multiple jar files into
> the CLASSPATH variable?

CP=""
for jar in *.jar; do
CP=$CP:$jar
done

export CLASSPATH=$CP:$CLASSPATH


This code puts all jar files in the current directory into the class
path.  This does not take into account the fact that CP will have a
leading ':'.  If you implement a simple flag variable you can eliminate
that.  I'll leave that as an exercise for the reader.  In fact this
whole question should have been an exercise for the reader.  It should
be trivial to have it use only a specific set of jar files.

Michael


> 
> Thanks.
> Russ
> 
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
> 



More information about the PLUG mailing list