All pastes #218110 Raw Edit

Plouj

public text v1 · immutable
#218110 ·published 2006-10-24 00:10 UTC
rendered paste body
#!/bin/bash
# check for the -t (testing) argument
ECHO=echo
TESTING=false
EXECUTER="" # blank by default because we want the proceeding commands executed

if [ "$1" = "-t" ]; then
        $ECHO "testing"
        TESTING=true
        # since we are testing, we don't want commands to be executed
        # rather, we just want to print what would be executed
        EXECUTER=$ECHO
fi

$EXECUTER touch /tmp/blkjaalkjsf
$EXECUTER $ECHO printing 1...2...3
$ECHO this command always gets executed as coded