[issue431] wm-ng on grml-medium 0.1

Frank Terbeck bts at bts.grml.org
Sat Feb 14 20:29:28 CET 2009


Frank Terbeck <ft at grml.org> added the comment:

Michael Prokop <bts at bts.grml.org>:
> Michael Prokop <mika at grml.org> added the comment:

[snip]
    #!/bin/bash

Seems like a plain sh script to me.
Bash can handle that of course. But it's not needed, AFAICS.

    # use Xdisplay only if present and running under X:
    display_info() {
    if type -a Xdialog 1>/dev/null 2>&1 && test -n "$DISPLAY" ; then
        Xdialog --title "grml-exec-wrapper" --msgbox "$1" 0 0 0
    else
        print "$1">&2

stderr? really?

    fi
    }

    if [ -z "$1" ] ; then
        display_info "Usage: $0 <program> [<arguments>]"
        exit 1
    fi

    RC='0'
    PROG="$1"

    # make sure to support 'grml-exec-wrapper sudo wireshark' as well:
    case $PROG in
        *sudo*) PROG="$2" ;;
    esac

    if type -a "$PROG" 1>/dev/null 2>&1 ; then
        exec $@

Rather:
exec "$@"

    else
        RC=1
        display_info "Sorry: ${PROG} not available.

    Looks like the grml flavour you are using does not ship ${PROG}. :(

    You can search for ${PROG} executing:

    apt-get update && apt-cache search ${PROG}
        "
    fi

The whole RC variable is unneeded.
The only way, you end up down here is if you come down from the else
path above (which is unneeded, for the very same reason.

Just 'exit 1' should be good enough (and much clearer).

If you're wondering why: if you call exec, the shell is done. It's
gone and won't come back.

    exit $RC
[snap]

Regards, Frank

----------
assignedto: mika
messages: 1244, 1245, 1876, 1877
nosy: ft, maddi, mika
priority: bug
status: in-progress
title: wm-ng on grml-medium 0.1
topic: release-stopper

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue431>
_____________________________________


More information about the Bugs-changes mailing list