write commands to temporary file and execute it to get around long command limitation