Skrypt przełączający bash

#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.

TOGGLE=$HOME/.toggle

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    command1
else
    rm $TOGGLE
    command2
fi
Precious Peafowl