All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.shell-exec.inc Maven / Gradle / Ivy

Go to download

A minimum REFCODES.ORG enabled command line interface (CLI) application. Get inspired by "https://bitbucket.org/funcodez".

There is a newer version: 2.0.5
Show newest version
#!/bin/bash

# //////////////////////////////////////////////////////////////////////////////
# Shell exec:
# //////////////////////////////////////////////////////////////////////////////

if type "tput" &> /dev/null; then 
	if [ -z "$COLUMNS" ]; then
		export COLUMNS="$(tput cols)"
	fi
	if [ -z "$LINES" ]; then
		export LINES="$(tput lines)"
	fi
fi

# See "https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable"
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
if type "uname" &> /dev/null; then
	if [ `uname -o` = "Cygwin" ]; then
		MYSELF=$(cygpath -w ${MYSELF})
	fi
fi
java=java
if test -n "$JAVA_HOME"; then
    java="$JAVA_HOME/bin/java"
fi
javaIndex="0"
appIndex="0"
for var in "$@"; do
    if [[ ${var} == -D* ]]; then
		javaArgs[${javaIndex}]="${var}"
		javaIndex=$((javaIndex + 1))
   	else
		appArgs[${appIndex}]="${var}"
		appIndex=$((appIndex + 1))
    fi
done
stty -echoctl &> /dev/null
exec "${java}" "${javaArgs[@]}" -jar "$MYSELF" "${appArgs[@]}"
exit $?




© 2015 - 2025 Weber Informatics LLC | Privacy Policy