Incorrect function error when command uses output redirection