Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: "Urbani, Edmund" <edmund.urbani@lilandit.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: hcitool lescan scripting question...
Date: Thu, 13 Nov 2014 17:56:21 +0100	[thread overview]
Message-ID: <1744955.ySyCBhVlDQ@uw000953> (raw)
In-Reply-To: <5461EEC6.8070706@LilandIT.com>

Hi Edmund,

On Tuesday 11 of November 2014 12:11:02 Urbani, Edmund wrote:
> 
> Hello,
> 
> now this may seem like a silly question, but I have been trying to do some 
> simple shell scripting with hcitool's LE scan and redirected its out and err 
> streams. The result is not quite what I am expecting:
> 
> hcitool lescan --duplicates > /tmp/lescan.out
> 
> This will create the output file immediately, but it remains empty until the 
> hcitool process terminates. Only then does the entire output get flushed. Any 
> idea why the output does not get written immediately? Ie. why I can't "tail -f 
> /tmp/lescan.out"?
> 
> My intention was to pipe the output through a shell script to add a timestamp to 
> each line, so I get a simple log during testing. I did not want to modify 
> hcitool/write my own C program just for this purpose.

This is due to stdout buffering. Try with stdbuf:
stdbuf -oL hcitool lescan --duplicates > /tmp/lescan.out

-- 
Best regards, 
Szymon Janc

      reply	other threads:[~2014-11-13 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 11:11 hcitool lescan scripting question Urbani, Edmund
2014-11-13 16:56 ` Szymon Janc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1744955.ySyCBhVlDQ@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=edmund.urbani@lilandit.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox