Sometimes the output of some command include other commands. And I'd like to start that command from output without using a mouse. For example, when command is not installed there is a message with line for installing this command:
$ htop The program 'htop' is currently not installed. You can install it by typing: sudo apt-get install htop
So. There I'd like to type a command, that will start the command from last line from output of
htop. How it can be done?
Edit: I'll try show what I mean. There are two lines in "output" of command
htop (actually, it's an error message). Second line of this message is the command
sudo apt-get install htop. So I'd like to extract second line from output, and start it's like command itself. The following is a rubbish but it shows what I mean:
htop | tail -1 | xargs start_command