bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tricky shell script question


From: Paul Jarc
Subject: Re: tricky shell script question
Date: Tue, 12 Feb 2008 16:44:07 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"Erik-Jan Taal" <erik.taal@wmfs.net> wrote:
> Now watch the terminal where the script was still running. I would
> expect no output to be given, as I assumed the script is read into memory
> at startup and not during execution and this is what happens on most 
> systems. On one server however, the 'bla' is echoed.

There are no guarantees here, except that each top-level statement is
entirely read before being executed.  Reading beyond the next command
to be executed can vary from one system to another, depending on stdio
buffering from libc.  So if you want to be sure that each execution
isn't affected by edits made while it is running, wrap the whole thing
in a compound statement that exits before returning:

#!/bin/sh
{
...
exit
}


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]