examples/b/bundled.js
function substiteVariable(variable, options, cb) {
    var value;
    var err = null;
    var s = variable.split(':', 2);
    if (s.length == 2) {
        value = options.env[s[0]];
        if (typeof value == 'function') {
            value = value();
        }
        if (s[1][0] == '+') {
            // Substitute replacement, but only if variable is defined and nonempty. Otherwise, substitute nothing
            value = value ? s[1].substring(1) : '';
        } else if (s[1][0] == '-') {
            // Substitute the value of variable, but if that is empty or undefined, use default instead
            value = value || s[1].substring(1);
        } else if (s[1][0] == '#') {
            // Substitute with the length of the value of the variable
            value = value !== undefined ? String(value).length : 0;
        } else if (s[1][0] == '=') {
            // Substitute the value of variable, but if that is empty or undefined, use default instead and set the variable to default
            if (!value) {
                value = s[1].substring(1);
                options.env[s[0]] = value;
            }
        } else if (s[1][0] == '?') {
            // If variable is defined and not empty, substitute its value. Otherwise, print message as an error message.
            if (!value) {
                if (s[1].length > 1) {
                    throw new Error();
                    // return cb(s[0] + ': ' + s[1].substring(1));
                } else {
                    throw new Error();
                    // return cb(s[0] + ': parameter null or not set');
                }
            }
        }
    } else {
        value = options.env[variable];
        if (typeof value == 'function') {
            value = value();
        }
    }
    return value;
}
function substiteVariable(variable, options, cb) {
    var value;
    var err = null;
    var s = variable.split(':', 2);
    if (s.length == 2) {
        value = options.env[s[0]];
        if (typeof value == 'function') {
            value = value();
        }
        if (s[1][0] == '+') {
            // Substitute replacement, but only if variable is defined and nonempty. Otherwise, substitute nothing
            value = value ? s[1].substring(1) : '';
        } else if (s[1][0] == '-') {
            // Substitute the value of variable, but if that is empty or undefined, use default instead
            value = value || s[1].substring(1);
        } else if (s[1][0] == '#') {
            // Substitute with the length of the value of the variable
            value = value !== undefined ? String(value).length : 0;
        } else if (s[1][0] == '=') {
            // Substitute the value of variable, but if that is empty or undefined, use default instead and set the variable to default
            if (!value) {
                value = s[1].substring(1);
                options.env[s[0]] = value;
            }
        } else if (s[1][0] == '?') {
            // If variable is defined and not empty, substitute its value. Otherwise, print message as an error message.
            if (!value) {
                if (s[1].length > 1) {
                    throw new Error();
                    // return cb(s[0] + ': ' + s[1].substring(1));
                } else {
                    throw new Error();
                    // return cb(s[0] + ': parameter null or not set');
                }
            }
        }
    } else {
        value = options.env[variable];
        if (typeof value == 'function') {
            value = value();
        }
    }
    return value;
}
function substiteVariable ( variable , options , cb ) { var value ; var err = null ; var s = variable . split ( ':' , 2 ) ; if ( s . length == 2 ) { value = options . env [ s [ 0 ] ] ; if ( typeof value == 'function' ) { value = value ( ) ; } if ( s [ 1 ] [ 0 ] == '+' ) { // Substitute replacement, but only if variable is defined and nonempty. Otherwise, substitute nothing value = value ? s [ 1 ] . substring ( 1 ) : '' ; } else if ( s [ 1 ] [ 0 ] == '-' ) { // Substitute the value of variable, but if that is empty or undefined, use default instead value = value || s [ 1 ] . substring ( 1 ) ; } else if ( s [ 1 ] [ 0 ] == '#' ) { // Substitute with the length of the value of the variable value = value !== undefined ? String ( value ) . length : 0 ; } else if ( s [ 1 ] [ 0 ] == '=' ) { // Substitute the value of variable, but if that is empty or undefined, use default instead and set the variable to default if ( ! value ) { value = s [ 1 ] . substring ( 1 ) ; options . env [ s [ 0 ] ] = value ; } } else if ( s [ 1 ] [ 0 ] == '?' ) { // If variable is defined and not empty, substitute its value. Otherwise, print message as an error message. if ( ! value ) { if ( s [ 1 ] . length > 1 ) { throw new Error ( ) ; // return cb(s[0] + ': ' + s[1].substring(1)); } else { throw new Error ( ) ; // return cb(s[0] + ': parameter null or not set'); } } } } else { value = options . env [ variable ] ; if ( typeof value == 'function' ) { value = value ( ) ; } } return value ; }
Shell variable substitution code taken from 'somewhere'?

Not sure who :(
This will be cleaned up at some point anyway
Shell variable substitution code taken from somewhere ?