Correct handling of shell commands in command_output method