#!/bin/sh
# Filename:      runit
# Purpose:       prompt for command via Xdialog and execute it afterwards
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Fre Jn 07 11:46:02 CET 2005 [mika]
################################################################################

tempfile=$(mktemp)
trap "rm -f $tempfile" 0 1 2 5 15

Xdialog --cr-wrap \
        --title "INPUT BOX" --clear \
        --inputbox \
"run command:" 0 0 2> $tempfile

retval=$?

COMMAND=$(cat "$tempfile")

case $retval in
  0)
    echo "Trying to run: $COMMAND"
    exec "$COMMAND" & ;;
  1)
    echo "Cancel pressed.";;
esac

## END OF FILE #################################################################
