Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to change the title of a terminal window during a long running command (for example: git svn fetch) with values greped from the output, whilst still writing to standard output.

Is this possible using named pipes or tee and xargs?

I'm thinking something like

git svn fetch | sed "s/^\(r\d*\).*$/ \"\\\033]0;\"\1\"\\\007\"/" | xargs -l1 echo -ne

based on: http://tldp.org/HOWTO/Xterm-Title-3.html


Update:

getting this to work would be enough:

(echo "r9" ; echo "r10") | sed "s/^\(r\d*\).*$/ \"\\\033]0;\"\1\"\\\007\"/" | xargs -l1 echo -ne

Update 2:

This almost does what I want. I see r10, but not r9:

(echo "r9" ; sleep 1 ; echo "r10") | sed "s/^\(r[0-9]*\)\.*$/\\\033]0;\1\\\007/" | xargs -0 echo -ne
share|improve this question

I don't have a complete answer, but one approach would be to use tee to send the output from git to another script AND standard output. Something like:

$ git svn fetch | tee grepping-and-prompt-changing-script.sh

There are some examples here:

http://linux.101hacks.com/unix/tee-command-examples/

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .