From: lihao on
Below is my pipe line under bash(RHEL5):

/path/to/my_script.sh 2>/dev/null | tee /path/to/log_file

I want to check the output from script '/path/to/my_script.sh'
immediately without having to wait for the buffer to be full. Is there
any bash configuration to handle this and only to this script [not to
the whole bash environment].

BTW. most of the output in the script "/path/to/my_script.sh" are from
the 'echo' command.

Thanks in advance,
lihao
From: pk on
lihao wrote:

> Below is my pipe line under bash(RHEL5):
>
> /path/to/my_script.sh 2>/dev/null | tee /path/to/log_file
>
> I want to check the output from script '/path/to/my_script.sh'
> immediately without having to wait for the buffer to be full. Is there
> any bash configuration to handle this and only to this script [not to
> the whole bash environment].
>
> BTW. most of the output in the script "/path/to/my_script.sh" are from
> the 'echo' command.

Try

man stdbuf

there is an example similar to yours near the end.
From: Janis Papanagnou on
lihao wrote:
> Below is my pipe line under bash(RHEL5):
>
> /path/to/my_script.sh 2>/dev/null | tee /path/to/log_file
>
> I want to check the output from script '/path/to/my_script.sh'
> immediately without having to wait for the buffer to be full. Is there
> any bash configuration to handle this and only to this script [not to
> the whole bash environment].

In bash; not that I know of.

I use a pty. If you like, have a look at the book "Advanced Programming in
the UNIX Environment". The source code of the pty program from the book are
available online. Google for it.

Janis

>
> BTW. most of the output in the script "/path/to/my_script.sh" are from
> the 'echo' command.
>
> Thanks in advance,
> lihao
From: Sidney Lambe on
On comp.unix.shell, lihao <lihao0129(a)gmail.com> wrote:
> Below is my pipe line under bash(RHEL5):
>
> /path/to/my_script.sh 2>/dev/null | tee /path/to/log_file
>
> I want to check the output from script '/path/to/my_script.sh'
> immediately without having to wait for the buffer to be full. Is there
> any bash configuration to handle this and only to this script [not to
> the whole bash environment].
>
> BTW. most of the output in the script "/path/to/my_script.sh" are from
> the 'echo' command.
>
> Thanks in advance,
> lihao

Maybe you could have those echos in the script also echo to,
say, /dev/pts/4

At the prompt, from /dev/pts/5:

echo -e "\n\nfoo\n" > /dev/pts/4

Output at /dev/pts/4

root:/root:
$

foo



Ctrl-c to exit.

Sid
From: Sidney Lambe on
On comp.unix.shell, Sidney Lambe <sidneylambe(a)nospam.invalid> wrote:
> On comp.unix.shell, lihao <lihao0129(a)gmail.com> wrote:
>> Below is my pipe line under bash(RHEL5):
>>
>> /path/to/my_script.sh 2>/dev/null | tee /path/to/log_file
>>
>> I want to check the output from script '/path/to/my_script.sh'
>> immediately without having to wait for the buffer to be full. Is there
>> any bash configuration to handle this and only to this script [not to
>> the whole bash environment].
>>
>> BTW. most of the output in the script "/path/to/my_script.sh" are from
>> the 'echo' command.
>>
>> Thanks in advance,
>> lihao
>
> Maybe you could have those echos in the script also echo to,
> say, /dev/pts/4
>
> At the prompt, from /dev/pts/5:
>
> echo -e "\n\nfoo\n" > /dev/pts/4
>
> Output at /dev/pts/4
>
> root:/root:
> $
>
> foo
>
>
>
> Ctrl-c to exit.
>
> Sid

Wait a second. They are already echoing to whatever pty you
are running the script from. Where else?
I guess I'm not following this and should just shut up.

Sid


 |  Next  |  Last
Pages: 1 2
Prev: Interpreting a script without executing it
Next: sed -f