Created
November 22, 2018 07:43
-
-
Save qlong8807/778b0d6610f2cbeb2d42e7bb165453d3 to your computer and use it in GitHub Desktop.
一个启动Java程序的SH脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ ! -n "${LIQUIBASE_HOME+x}" ]; then | |
# echo "LIQUIBASE_HOME is not set." | |
## resolve links - $0 may be a symlink | |
PRG="$0" | |
while [ -h "$PRG" ] ; do | |
ls=`ls -ld "$PRG"` | |
link=`expr "$ls" : '.*-> \(.*\)$'` | |
if expr "$link" : '/.*' > /dev/null; then | |
PRG="$link" | |
else | |
PRG=`dirname "$PRG"`"/$link" | |
fi | |
done | |
LIQUIBASE_HOME=`dirname "$PRG"` | |
# make it fully qualified | |
LIQUIBASE_HOME=`cd "$LIQUIBASE_HOME" && pwd` | |
# echo "Liquibase Home: $LIQUIBASE_HOME" | |
fi | |
# build classpath from all jars in lib | |
if [ -f /usr/bin/cygpath ]; then | |
CP=. | |
for i in "$LIQUIBASE_HOME"/liquibase*.jar; do | |
i=`cygpath --windows "$i"` | |
CP="$CP;$i" | |
done | |
for i in "$LIQUIBASE_HOME"/lib/*.jar; do | |
i=`cygpath --windows "$i"` | |
CP="$CP;$i" | |
done | |
else | |
if [[ $(uname) = MINGW* ]]; then | |
CP_SEPARATOR=";" | |
else | |
CP_SEPARATOR=":" | |
fi | |
CP=. | |
for i in "$LIQUIBASE_HOME"/liquibase*.jar; do | |
CP="$CP""$CP_SEPARATOR""$i" | |
done | |
CP="$CP""$CP_SEPARATOR""$LIQUIBASE_HOME/lib/" | |
for i in "$LIQUIBASE_HOME"/lib/*.jar; do | |
CP="$CP""$CP_SEPARATOR""$i" | |
done | |
fi | |
# add any JVM options here | |
JAVA_OPTS="${JAVA_OPTS-}" | |
java -cp "$CP" $JAVA_OPTS liquibase.integration.commandline.Main ${1+"$@"} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment