Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:45:48+00:00 2026-05-31T12:45:48+00:00

so i am running this on bash: # somedevice -getevent What this command does

  • 0

so i am running this on bash:

# somedevice -getevent

What this command does is it just keeps running, and everytime my device sends a certain data, say it detects change in temperature, it outputs something like this

/dev/xyz: 123 4567 8910112238 20
/dev/xyz: 123 4567 8915712347 19
/dev/xyz: 123 4567 8916412345 22
/dev/xyz: 123 4567 8910312342 25
/dev/xyz: 123 4567 8910112361 18
/dev/xyz: 123 4567 8910112343 20

And this just keeps running and as soon as it has any cause it outputs something. So there is no end to execution.

No the echo is working perfectly, however when i am trying to use the ‘>’ operator this doesn’t seem to write to file.

so for instance

#somedevice -getevent > my_record_file

this doesn’t work properly, my_record_file only gets data written to it in intervals, however i want to be written immediately.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:45:49+00:00Added an answer on May 31, 2026 at 12:45 pm

    The output is being buffered because the C standard library changes the output buffering mode depending on whether or not stdout is a terminal device. If it’s a terminal device (according to isatty(3)), then stdout is line-buffered: it gets flushed every time a newline character gets written. If it’s not a terminal device, then it’s fully buffered: it only gets flushed whenever a certain amount of data (usually something on the order of 4 KB to 64 KB) gets written.

    So, when you redirect the command’s output to a file using the shell’s > redirection operator, it’s no longer outputting to a terminal and it buffers its output. A program can change its buffering mode with setvbuf(3) and friends, but the program has to cooperate to do this. Many programs have command line options to make them line-buffered, e.g. grep(1)‘s --line-buffered option. See if your command has a similar option.

    If you don’t have such an option, you can try using a tool such as unbuffer(1) to unbuffer the output stream, but it doesn’t always work and isn’t a standard utility, so it’s not always available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made this bash one-liner which I use to list Weblogic instances running along
In ZF you create a project by running this command: zf create project MyProjectName
Running this prints out both statements #!/bin/bash echo Hello && echo World However, running
I want to execute a long running command in Bash, and both capture its
Using mysql directly from the command line (running on Ubuntu 9.10, standard bash terminal),
Im running this query on the same server as the web application, so SPQuery.ExpandRecurrence
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
I'm running this small C# test program launched from a pre-commit batch file private
I'm running this C# code in Visual Studio in debug mode: public class MyHandlerFactory
I'm running this query: SELECT TOP 1 [DVD Copy].[Stock No] FROM [DVD Copy] WHERE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.