Output redirection in scripts not what I expected it to be, making everything print to stdout/stderr