This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: SHELLOPTS=igncr and bash --posix
- From: Rafael Kitover <rkitover at cpan dot org>
- To: cygwin at cygwin dot com
- Date: Fri, 30 Dec 2011 07:41:13 -0500
- Subject: Re: SHELLOPTS=igncr and bash --posix
- References: <4EFCDE35.4040302@cpan.org> <4EFD54D1.9080508@gmail.com>
- Reply-to: rkitover at cpan dot org
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@eeebox ~/src/scala % echo $SHELLOPTS
>> igncr
>> rkitover@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@eeebox ~ % export SHELLOPTS=igncr
rkitover@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