Use a tmp file instead of pipe to avoid human intervention