function execCmd(i) {
    var cmd = cmdlines[i];
    if (!cmd) return;

    var child = exec(cmd,
        function (error, stdout, stderr) {
            if (stdout) {
                console.log('-- exec stdout: ');
                console.log(stdout);
            }
            if (stderr) {
                console.log('-- exec stderr: ');
                console.log(stderr);
            }
            if (error) {
                console.log('-- exec error: ');
                console.log(error);
            }

            execCmd(++i);
        });
}
function execCmd(i) {
    var cmd = cmdlines[i];
    if (!cmd) return;

    var child = exec(cmd,
        function (error, stdout, stderr) {
            if (stdout) {
                console.log('-- exec stdout: ');
                console.log(stdout);
            }
            if (stderr) {
                console.log('-- exec stderr: ');
                console.log(stderr);
            }
            if (error) {
                console.log('-- exec error: ');
                console.log(error);
            }

            execCmd(++i);
        });
}
function execCmd ( i ) { var cmd = cmdlines [ i ] ; if ( ! cmd ) return ; var child = exec ( cmd , function ( error , stdout , stderr ) { if ( stdout ) { console . log ( '-- exec stdout: ' ) ; console . log ( stdout ) ; } if ( stderr ) { console . log ( '-- exec stderr: ' ) ; console . log ( stderr ) ; } if ( error ) { console . log ( '-- exec error: ' ) ; console . log ( error ) ; } execCmd ( ++ i ) ; } ) ; }
console.log(cmdlines);
console . log ( cmdlines ) ;