Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.