Daniel Bareiro <[email protected]> wrote:
> What I meant is to have a group of commands in a script that, in
> addition to being executed, I want these commands are stored in a log.

    LOG=/var/log/...logfile...

    ExecAndLog()
    {
        # Season with date, PID, user, etc., to taste
        echo "$*" >>"$LOG"
        "$@"

        # Could capture $? (exit status), stdout, stderr, etc. if desired
    }

    # ...later...

    ExecAndLog $IP route add ...whatever...
    ExecAndLog $IP route add ...whatever...
    ExecAndLog $IP route add ...whatever...

Chris


-- 
To UNSUBSCRIBE, email to [email protected] 
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: https://lists.debian.org/[email protected]

Reply via email to