Bob McGowan wrote:
> All this got me to wondering, so I looked at the two links Bob provided.
> And, I did some tests of my own.
>
> First, I think there's an error on the SubShell page, in the "example"
> of the difference between a "subshell" and a full "child process", at
> the end. The autho
On 08/24/2010 04:09 AM, Oliver Schneider wrote:
> Hello Cameron, Bob,
>
>> As soon as I read this paragraph I saw the problem. I confirmed it
>> looking at the code. It's a common problem.
>>
>> This construct:
>>
>> some_cmd | while read var ; do
>> OTHER_VAR=...
>> done
>>
>> will result in
On Tue August 24 2010 04:09:39 Oliver Schneider wrote:
> Okay, that is surprising indeed, as SHLVL is not being adjusted to reflect
> that fact, according to my findings. But thanks a bunch for pointing that
> out. It's surely more elegant to use this method than to write to a
> temporary file.
Yo
Hello Cameron, Bob,
> As soon as I read this paragraph I saw the problem. I confirmed it
> looking at the code. It's a common problem.
>
> This construct:
>
> some_cmd | while read var ; do
> OTHER_VAR=...
> done
>
> will result in OTHER_VAR being unset at the completion of the loop. That
>
Cameron Hutchison wrote:
> This construct:
>
> some_cmd | while read var ; do
> OTHER_VAR=...
> done
>
> will result in OTHER_VAR being unset at the completion of the loop. That
> is because the while command is on the right-hand side of the pipe
> meaning it runs in a subshell. At the end of
"Oliver Schneider" writes:
>Both cases can occur in several places (outer while loop). Since the
>paths can contain blanks, I resorted to a "while read" loop because
>"for" simply would tokenize the file names more than desirable.
As soon as I read this paragraph I saw the problem. I confirmed i
Hi again.
On 23.08.2010 21:45, Burton Samograd wrote:
> You might have to >> the source file name to a temporary file from
> the sourced scripts and then read that after the loop is done. Since
> while seems to capture variable setting in its own scope it might be
> the only way for what you wa
"Oliver Schneider" writes:
> Hi folks,
>
> on my Debian box I'm running GNU bash, version 3.2.39(1)-release
> (i486-pc-linux-gnu).
>
> Now, today I ran across a slight problem that I fail to understand. I
> have one script that acts as a library of a kind. I.e. it is being
> sourced by other scri
8 matches
Mail list logo