X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=2.9 required=5.0 tests=AWL,BAYES_05,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-InterSystems: Sent from InterSystems X-InterSystems: Sent from InterSystems X-InterSystems: Sent from InterSystems From: Len Giambrone To: "cygwin AT cygwin DOT com" CC: Len Giambrone Date: Fri, 22 Apr 2011 21:30:07 -0400 Subject: bash 4.1.10: SHELLOPTS questions -- different behavior between sh and bash Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Message-Id: <20110423013010.942639D5A05@mail2.intersystems.com> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Greetings. I'm running the latest (as of a few days ago) Cygwin and bash. Cygwin Package Information Package Version Status bash 4.1.10-4 OK cygwin 1.7.9-1 OK If I set -o igncr, and then export SHELLOPTS as stated in /usr/share/doc/Cy= gwin/bash.README: 4d. Added in the bash-3.2-2 release: export the environment variable SHELLOPTS with igncr included in it. It is read-only from within bash, but you can set it before invoking bash; once in bash, it auto-tracks the current state of 'set -o igncr'. If exported, then all bash child processes inherit the same option settings; with the exception added in 3.2.9-11 that certain interactive options are not inherited in non-interactive use. I get different behavior depending on whether I use bash or sh. Further, I= only get an error message if I have a script that calls a script: $ cat foo echo foo ./bar $ cat bar echo bar $ set -o igncr $ export SHELLOPTS $ sh bar bar $ bash bar bar $ sh foo foo sh: SHELLOPTS: readonly variable bar $ bash foo foo bar I know bash and sh are the same program which behaves differently depending= on how it's called.=20 Is this expected behavior? Is there a way using sh to always avoid the err= or message? -Len -- 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