#!/bin/sh # echorun 0.01 # # Copyright (C) 2000: Manel Marin # Licence: GNU GPL version >= 2 # # # Lanza comando haciendo echo de la linea de comando si hay mensajes # (stdout/stderr) o si esta definida la variable de entorno $DEBUG # (con export DEBUG=si) # # PORQUE # ipchains no da la regla que falla al informar de errores, con lo que # es complicado solucionarlo cuando tienes muchas... # # Uso: echorun comando parametros # # # ------ # Runs command echoing command line if there is message (stdout/stderr) # or if defined environment var $DEBUG (with export DEBUG=yes) # # WHY # ipchains does not give the rule when reporting errors, so it is # complicated to fix when you have a lot of them... # # Use: echorun command parameters # if [ "$DEBUG" != "" ] then echo "$*" # Si DEBUG mostrar comando / If DEBUG show command fi msg=`$* 2>&1` # Ejecuto comando y leo salida/errores y status status=$? # Run command and read output/errors and status # Si hay salida mostrar comando y mensaje / If message show command and message if [ "$msg" != "" ] then echo echo "---- STATUS:$status --------" echo " $*" echo " $msg" echo fi