function addProfileStatement() {
    name="$1";
    title="$2";
    shellBin="$3";
    extension="$4";
    profileRoot="$5";

    if [ ! -z "${@:6}" ]
    then
        statement="${@:6}";
    else
        statement="$(cat)";
    fi;

    contextRoot="$(mktemp -d)";
    pushd "$contextRoot" > /dev/null;

    {
        echo '#!'"$shellBin";
        echo "# $title";
        echo "$statement";
    } > "profile.$extension";

    sudo install -Dm755 profile.$extension "$profileRoot/$name.$extension"

    popd > /dev/null;
    rm -rf "$contextRoot";
}