X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <A4AC3816FD34354F878DD1F440F3ABCE02284615@CINMLVEM24.e2k.ad.ge.com>
References: <A4AC3816FD34354F878DD1F440F3ABCE02284615@CINMLVEM24.e2k.ad.ge.com>
Date: Tue, 18 May 2010 14:23:14 -0600
Message-ID: <AANLkTinZUAtd_g3XeSDQdPQJbqL64Cg3RsKXVtNvLH8y@mail.gmail.com>
Subject: Re: 1.7.5: Bug with bash read in /etc/profile.d invocation
From: Steven Collins <spc.for.nbc@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Look at /etc/profile where it runs the profile.d scripts.

The scripts are run with standard input redirected to a here document
generated by a find command. That is the source of the
"/etc/profile.d/xinit.sh" you're seeing as the answer. The "read"
statement in your script is actually consuming one of the arguments
intended to be processed by the "read" in /etc/profile.

Because the scripts are sourced by the current shell your "#!" line
has no affect ("-x" isn't getting set.)

In other words, the shell is doing exactly what it has been told to
do. Don't use a read in your profile.d scripts unless you make sure to
reroute standard input back to the terminal.

On Thu, May 13, 2010 at 07:16, Garber, Dave (GE Infra, Energy, Non-GE) <> w=
rote:
> #!/usr/bin/bash -x
> =A0 =A0 =A0 =A0echo In p.sh
> =A0 =A0 =A0 =A0read -p "How are you today? " Ans
> =A0 =A0 =A0 =A0echo Ans is $Ans

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

