merged logic and redirection with execv