added exec(cmd,output,input,error,avpenv) function for exec

Could you change that to [input], [output], [error] ? That makes sense for everyone familiar with standard unix convention (0=stdin, 1=stdout, 2=stderr). It's not too late to fix now.

And add a space before `[envavp]`.