Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
#! /bin/sh
echo "$(byobu ls|grep attached)"|sed 's/\([a-zA-Z0-9][a-zA-Z0-9]*\).*/\1/'

this is my script in ~/.byobu/bin/ refresh time is 1 second.

This shows the session name as the custom status,but it does so for all but 1 session.In place of showing the session name it shows ]0 for that session.

Is it some issue with the echo command ?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The problem can be found when you do Byobu ls |grep attached >> ~/byobu_out.

When you cat this file the output is normal i.e

session1name:details 
session2name:details

but when you open it in vi then you see that the file is like this:

^[]0;[user@host](x.x.x.x)] - byobu^Gsession1name:details
session2name:details

So when you pass this output through sed it stops at ]0.

To overcome this use tail -c +x [filename] to see the output, where x is the number of byte of the junk header.

Also the junk header is nothing but the title of the window of the byobu terminal.

share|improve this answer
    
it's me with who solved it in the end...accidentally made two accounts...any one knows how to merge them? –  Anurag Nov 2 '12 at 13:26

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.