1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#!/bin/bash
# Path to this script
FILE="${BASH_SOURCE[0]}"
while [ -h "$FILE" ] ; do
SRC="$(readlink "$FILE")"
FILE="$( cd -P "$(dirname "$FILE")" && \
cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")"
done
BX="$( cd -P "$(dirname "$FILE")/.." && pwd )"
# Core and library classes
CP="$BX/target/classes"
CP="$CP$(for JAR in "$BX"/lib/*.jar; do echo -n ":$JAR"; done)"
# Options for virtual machine
VM=-Xmx512m
general_args=( )
vm_args=( )
while (( $# )) ; do
if [[ $1 = "-X" ]] ; then
vm_args+=( "$2" )
shift 2
else
general_args+=( "$1" )
shift
fi
done
# Run code
java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseX -q "${general_args[@]}"
|