delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/30/07:42:08

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4EFDB169.6050107@cpan.org>
Date: Fri, 30 Dec 2011 07:41:13 -0500
From: Rafael Kitover <rkitover AT cpan DOT org>
Reply-To: rkitover AT cpan DOT org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: SHELLOPTS=igncr and bash --posix
References: <4EFCDE35 DOT 4040302 AT cpan DOT org> <4EFD54D1 DOT 9080508 AT gmail DOT com>
In-Reply-To: <4EFD54D1.9080508@gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 12/30/2011 1:06 AM, Dave Korn wrote:
> On 29/12/2011 21:40, Rafael Kitover wrote:
>> Some of my bash scripts, particularly ones that are #!/bin/bash --posix
>> trigger a nasty warning when I have SHELLOPTS=igncr set in my ~/.zshrc:
>>
>> rkitover AT eeebox ~/src/scala % echo $SHELLOPTS
>> igncr
>> rkitover AT eeebox ~/src/scala % bash --posix
>> bash: SHELLOPTS: readonly variable
>>
>> this is rather unsightly so I have turned off SHELLOPTS for now.
>>
>> Is this a bug? 
> 
>   Bug in your script I'm afraid.  SHELLOPTS is indeed a readonly variable, it
> can only be set outside bash before starting it, definitely not from within a
> startup script.  (Perhaps the reason it seems associated with --posix is
> because that selects different startup files?  I'm guessing that you may have
> ENV=~/.zshrc because it's not normal behaviour for bash to read zsh's startup
> file!)

I don't have ENV set.

If I comment out the SHELLOPTS setting in ~/.zshrc then do this the
problem still appears:

rkitover AT eeebox ~ % export SHELLOPTS=igncr
rkitover AT eeebox ~ % bash --posix
bash: SHELLOPTS: readonly variable
%{
%}(%n@%m)[%h] %{%}%~%{%}
$

I do not have a ~/.profile, and ~/.bash_profile just reads ~/.bashrc. I
do not set SHELLOPTS in ~/.bashrc, it only has set -o igncr.

> 
>> If so, is a fix possible?
> 
>   Use "set -o igncr" instead.

But if I want to use CRLF #/bin/sh scripts from zsh, then I have to set
SHELLOPTS.

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019