Command to execute another command while replaying the command on STDOUT

Posted by hakre on Server Fault See other posts from Server Fault or by hakre
Published on 2011-06-09T18:08:12Z Indexed on 2012/12/04 11:12 UTC
Read the original article Hit count: 490

Filed under:
|
|

It's not easy to formulate the question properly, maybe it helps when I describe what I'd like to do.

I want to execute a command and pipe it's output into a tool called pastebinit which uploads the STDOUT output to pastebin.

That works very well, however I would like to send the command itself on top of it but w/o typing it a second time.

Is there some command I can launch "my command" with that will

  1. Print "my command" on STDOUT
  2. Executes "my command"

I have the feeling that something like that exists but as hard as it is to formulate such a question properly, I was not able to dig it up with google so far.

© Server Fault or respective owner

Related posts about linux

Related posts about shell