Daniel Bareiro <daniel-lis...@gmx.net> 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 debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/nh3l2bx3tg....@news.roaima.co.uk

Reply via email to