X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=crKLwndJqbqhjWEE
	NW8FcBd+5fQ3nRJUPTfRdnuE91u+66cZqKF8z958XdlX6Pni7FNRz5D54s5ReX0+
	izTepIU+i9Ir1zCNmfA1Vmr2ggDPahwlJqdUqK8oTPcJI/Id46UMSLSWZJXK/Ih4
	EjL5CO0LGlAfDJPeUPaDz0SYVsE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:references:to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=LlRlBpAcvWvzTzA7C/weNL
	ImkXE=; b=wxruC7awLfHDqDkmpXfDEVRIwOSNFdOPMZhsRDY562YxXfNM9zJ6Tw
	eyh2659IJ3XJi+DhcfC2rImg3Thap9o7ib4uYwK32AEONKpYb74HU42eibH5Qt8/
	Lj8i/OVbFTG3jj89mOOBI/NM+H8OuRztOgeMwkgYVh4L/NDEGlbY0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss@cs.umass.edu
Subject: Re: alias appears to not work inside a called bash script
References: <000001d31acd$108b0340$31a109c0$@rogers.com> <CANnLRdgWnygyp36uYmpzq7i3BvgHonL5H8CPy_Vr+wOYmWjp4w@mail.gmail.com> <0ac245f1-002b-2993-c1de-e4ddaafa9c7d@cs.umass.edu> <CANnLRdgBU-Gact9rTN3cSYVy6UMe83r=EYyVsvwS97k8VuxD6g@mail.gmail.com>
To: cygwin@cygwin.com
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <637017a5-b774-cb10-f064-065d20e421b3@cs.umass.edu>
Date: Tue, 22 Aug 2017 12:45:55 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CANnLRdgBU-Gact9rTN3cSYVy6UMe83r=EYyVsvwS97k8VuxD6g@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On 8/22/2017 11:18 AM, Stephen John Smoogen wrote:
> On 22 August 2017 at 10:47, Eliot Moss <moss@cs.umass.edu> wrote:
>> On 8/22/2017 10:31 AM, Stephen John Smoogen wrote:

>> It's a *bash* default - it has nothing to do with Cygwin as distinct
>> from other bash installations.  If you had a different experience
>> elsewhere, it could be that the default was overridden in some system
>> wide bashrc file - but that strikes me as unlikely.  I suspect that
>> this is done as a security measure, to prevent an alias from introducing
>> a surprise.
>>
>
> I checked on CentOS and there is no shopt option set in any of the
> /etc/ files. It must be a compiled in default of some sort as EL6 and
> EL7 both work without an explicit `shopt -s expand_aliases`. I then
> tried on an Ubuntu 16.04 system and it works without the `shopt -s
> expand_aliases` also.
>
> I didn't have access to anything else at the moment so I can't say
> which other systems might actually follow the default other than
> Cygwin at the moment.

Hmmm ... One of my servers runs EL7 and it works there exactly as under
Cygwin on my laptop.  I wonder: Is there an nawk installed somewhere
on your path on these CentOS and EL* systems?  Put another way, if you
put 'type -a nawk' in your script *before* the alias lines, what output
do you get?  And what about shopt?  I added these lines before the alias
lines:

shopt | grep expand_aliases
type -a nawk
type -t nawk

Regards - Eliot

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

