Skip to content

Instantly share code, notes, and snippets.

@seasonedgeek
Forked from jcromartie/classpath.sh
Created January 5, 2019 03:51
Show Gist options
  • Save seasonedgeek/28d0b275ee9fb57aa4cabd748a7559a5 to your computer and use it in GitHub Desktop.
Save seasonedgeek/28d0b275ee9fb57aa4cabd748a7559a5 to your computer and use it in GitHub Desktop.
classpath.sh -- build classpaths
#/bin/bash
# strings together all of its arguments into a Java classpath, useful for
# grabbing all of the jars in a directory like so:
# classpath.sh lib/*.jar
#
usage(){
echo "Usage: $0 /path/to/*.jar"
exit 1
}
# invoke usage
# call usage() function if /path/to/*.jar files not supplied
[[ $# -eq 0 ]] && usage
DELIM=
CLASSPATH=
for PATH_PART in "$@"
do
CLASSPATH="$CLASSPATH$DELIM$PATH_PART"
DELIM=:
done
echo $CLASSPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment