Usecase: You run a command, the output is displayed in your terminal. Now that you see the output, you would like to grab say an ID from this output. Instead of coping and pasting the output, I would like to be able to do something like: # grep 'the thing that you want' <<< ${COMMAND_OUTPUT} | ./some_script
Where COMMAND_OUTPUT is the last n number of output lines from the previous command. Now, I've looked at several ways of implementing this is Bash. They all break in various ways, because it usually means pushing all output to a file/variable and then pushing it to stdout. Would it be feasible to have Bash tee off anything intended for stdout to a variable? Is there already some way of achieving this functionality? If not, could anyone give me some pointers as to where or how this could be implemented? Thanks Anders Brujordet