Changeset 15916 in josm for trunk/linux/latest/usr/bin


Ignore:
Timestamp:
2020-02-23T22:05:36+01:00 (5 years ago)
Author:
simon04
Message:

fix #18756 - Fix shellcheck warnings of shellscripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/linux/latest/usr/bin/josm-latest

    r15914 r15916  
    1 #!/bin/sh
     1#!/bin/bash
    22# Simple wrapper script used to start JOSM in Debian
    33set -e
     
    55# First, the alternative (if known to work) or users preference as defined by $JAVA_HOME. Next, use OpenJDK.
    66# Override to a specific one using $JAVACMD
    7 ALTERNATIVE_JDK="`readlink -n -f /etc/alternatives/java`"
     7ALTERNATIVE_JDK=$(readlink -n -f /etc/alternatives/java)
    88
    99# Let's get the current architecture -- needed for multiarchified Java
    10 ARCH="`dpkg --print-architecture 2> /dev/null || true`"
     10ARCH=$(dpkg --print-architecture 2> /dev/null || true)
    1111
    1212JAVA_CMDS="$JAVA_HOME/bin/java"
    1313
    1414# If OpenJDK is only available headless, do not try it
    15 if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null \
    16 || dpkg --get-selections 'openjdk-*-jre:$ARCH' | grep install$ > /dev/null ; then
     15if dpkg --get-selections "openjdk-*-jre" | grep install$ > /dev/null \
     16|| dpkg --get-selections "openjdk-*-jre:$ARCH" | grep install$ > /dev/null ; then
    1717        # LTS versions in decreased order
    1818        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-11-openjdk/bin/java /usr/lib/jvm/java-11-openjdk-$ARCH/bin/java"
     
    3838if [ -z "${JAVACMD}" ]; then
    3939    for jcmd in $JAVA_CMDS; do
    40         if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
     40        if [ "z$ALTERNATIVE_JDK" = "z$(readlink -n -f "$jcmd")" ] && [ -z "${JAVACMD}" ]; then
    4141            JAVACMD="$jcmd"
    4242            break
     
    4747if [ -z "${JAVACMD}" ]; then
    4848    for jcmd in $JAVA_CMDS; do
    49         if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
     49        if [ -x "$jcmd" ] && [ -z "${JAVACMD}" ]; then
    5050            JAVACMD="$jcmd"
    5151            break
     
    5656if [ "$JAVACMD" ]; then
    5757    echo "Using $JAVACMD to execute josm-latest." || true
    58     if [ "`expr match \"${JAVACMD}\" 'java-9'`" != "0" ] || [ "`expr match \"${JAVACMD}\" 'java-10'`" != "0" ]; then
     58    if [[ "${JAVACMD}" =~ 'java-9' ]] || [[ "${JAVACMD}" =~ 'java-10' ]]; then
    5959        JAVA_OPTS="--add-modules java.activation,java.se.ee $JAVA_OPTS"
    60     elif [ "`expr match \"${JAVACMD}\" 'java-1'`" != "0" ]; then
     60    elif [[ "${JAVACMD}" =~ 'java-1' ]]; then
    6161        JAVA_OPTS="--add-modules java.scripting,java.sql $JAVA_OPTS"
    6262    fi
    6363    set +e
    6464    while true; do
    65         $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
     65        $JAVACMD "$JAVA_OPTS" -jar /usr/share/josm-latest/josm-latest.jar "$@"
    6666        if [ "z$?" != "z9" ]; then
    6767            break
Note: See TracChangeset for help on using the changeset viewer.