bug-bash
[Top][All Lists]
Advanced

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

Re: ldapscripts unusable from within a 'while read line' loop


From: Lakshminarasimhan Srinivasan
Subject: Re: ldapscripts unusable from within a 'while read line' loop
Date: Thu, 01 Aug 2013 16:55:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12


On 08/01/2013 04:09 PM, Greg Wooledge wrote:
On Thu, Aug 01, 2013 at 09:37:38AM +0200, Lakshminarasimhan Srinivasan wrote:
         ldapscripts do not work from inside a "while read line" loop.
The exact same scripts were working fine until the last upgrade
-------------------------------------------------
#!/bin/bash
echo "Testing if it works outside of the loop"
ldapid
echo "Getting into the read line loop"
while read line
do
   ldapid
done<"Some file"
------------------------------------------------
This sounds like a change was made to whatever package "ldapid" is in.
If ldapid reads from standard input, it will conflict with the use of
stdin by "read".

You can work around the problem by doing something like this:

while read line<&3
do
   ldapid
done 3<  "Some file"

This way, read isn't using the same stdin file descriptor that ldapid is
(presumably) using.

This is not a bash bug.  It may or may not be an ldapid bug, as I have
no idea what that program does.
Can confirm that work around worked perfectly. I thought it was after a change in 'read', very sorry about the false report and many thanks to both you and Chris F.A. Johnson for taking the time to answer.

Cheers,
Laks





reply via email to

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