# Unnecessary process execution

# The first problem is that the program uname is executed three times every time this script is executed. A simple solution is to use environment variables.
# That is, if the environment variables are set, then there is no need to execute the uname program:

    #!/bin/sh -a
    OS=${OS=$(uname -s)}
    REV=${REV=$(uname -r)}
    ARCH=${ARCH=$(uname -m)}
    CMD=$(basename "$0")
    /usr/local/$OS/$REV/$ARCH/bin/$CMD "$@"

# The "-a" shell option says to mark all modified variables for auto-export. This script tests three environment variables, and if not defined, it sets these variables. You could, therefore, set these variables once when you log in.
# Thereafter, the uname program need not be executed. 
