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: Greg Wooledge
Subject: Re: ldapscripts unusable from within a 'while read line' loop
Date: Thu, 1 Aug 2013 10:09:29 -0400
User-agent: Mutt/1.4.2.3i

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.



reply via email to

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