Fixed logic to export script for different envs