This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: 1.7.5: Bug with bash read in /etc/profile.d invocation
Anyone have an ideas? I'm stumped.
Thanks,
Dave
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of Garber, Dave (GE Infra, Energy, Non-GE)
Sent: Wednesday, May 19, 2010 9:35 AM
To: cygwin@cygwin.com
Subject: RE: 1.7.5: Bug with bash read in /etc/profile.d invocation
OK, I changed my script to have:
read -p "How are you today? " Ans </dev/stdin But I now get "bash: /dev/stdin: No such file or directory"
Since profile is redirecting stdin & stdout, wouldn't it make more sense for profile to redirect stdin and stdout back to normal when sourcing the profile.d scripts?
Thanks,
Dave
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of Garber, Dave (GE Infra, Energy, Non-GE)
Sent: Tuesday, May 18, 2010 4:30 PM
To: cygwin@cygwin.com
Subject: RE: 1.7.5: Bug with bash read in /etc/profile.d invocation
Thanks for the info. This didn't happen in 1.5.25 so something with 1.7.5 is different. I'll go back to my 1.5.25 setup and look at /etc/profile and see what's different.
Dave
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of Steven Collins
Sent: Tuesday, May 18, 2010 4:23 PM
To: cygwin@cygwin.com
Subject: Re: 1.7.5: Bug with bash read in /etc/profile.d invocation
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) <> wrote:
> #!/usr/bin/bash -x
> ? ? ? ?echo In p.sh
> ? ? ? ?read -p "How are you today? " Ans
> ? ? ? ?echo 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
--
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
--
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
--
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