www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/08/22/13:08:14

X-Recipient: archive-cygwin AT delorie DOT 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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=msxodRnXRQSccRq2
CpsX9KaHG50Ly2FlRYgQRD4DFcc2/HjPb21mIZa/5lrq094DxNkZaPanAMk+2Wof
sMoPTlq8qIPrWOgcK8KzaOCIh8QP5Rkiz1HMg7MckyxXLaj3+qXnoS/whaWZD0MR
Iv/wR8Z8XMT5YiNO6T1AGKtuNYk=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=IOzI3hx21dnf4w3PK54AQn
ivC/4=; b=pWwnL7By1LMMgLdGQqmJ5fA9P/I8Xo60oXw0ymLuflyRhn+csgrYh5
9ew/11l0VFNLs41j4iLxMTmOs2rtM2e8VsJ2szLlMckDS3NJgC1T2yVbw/0guHp6
pCZ5eeBAbscdsyEcS2KV5r4hASnXodMG/jUBtFrZlDTwCgBdKLT98=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:1614, HContent-Transfer-Encoding:8bit
X-HELO: mail-io0-f172.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=m8h7xZqgjjFSyYKynVdblOoacZBKp5tts2AYb4MMFfw=; b=cO6VnI8cIFcsc4F+FsPRp7s5y7ceekBudEztd9/39uhxE7v/ZIB4hq3LrsJDV3DbJR eS7vzPflUszGYi1BKXg/VxVuEK2+9iOGHJdst5DRVRVgvNOT3dvW9a7Iu/aUX+8+38lT 4YQbphZoskqrr/+jXf9z+10fylIry426FBb/dDRxXgDLIfjGslUaksZY7uEj6+lCoVWa IfWnIy+EDNvvsebM3MGQmm4zzH0o1QqfIv79o9AlnmmIUY865d4CxAicc4t5YbviOXVN vi5pjjOMYT4EKxhwxt9g75f0ZvZGDy+En+P4p5TRzFJ9xAeA9DMFO5TwIf1lgBNsHAeT fjlw==
X-Gm-Message-State: AHYfb5i+WovQwJDQhe7TSlKcwP1tmuiaFo17CM/6/CMxatSlqB6ml5yu smEqqiIbgXrlgy0Q
X-Received: by 10.107.173.130 with SMTP id m2mr1162231ioo.281.1503421677024; Tue, 22 Aug 2017 10:07:57 -0700 (PDT)
Subject: Re: alias appears to not work inside a called bash script
To: cygwin AT cygwin DOT com
References: <000001d31acd$108b0340$31a109c0$@rogers.com> <CANnLRdgWnygyp36uYmpzq7i3BvgHonL5H8CPy_Vr+wOYmWjp4w AT mail DOT gmail DOT com> <0ac245f1-002b-2993-c1de-e4ddaafa9c7d AT cs DOT umass DOT edu> <CANnLRdgBU-Gact9rTN3cSYVy6UMe83r=EYyVsvwS97k8VuxD6g AT mail DOT gmail DOT com>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <99262820-ed21-d20d-8da0-2c0daa29f476@gmail.com>
Date: Tue, 22 Aug 2017 13:07:58 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <CANnLRdgBU-Gact9rTN3cSYVy6UMe83r=EYyVsvwS97k8VuxD6g@mail.gmail.com>
X-IsSubscribed: yes

On 8/22/2017 11:18 AM, Stephen John Smoogen wrote:
> On 22 August 2017 at 10:47, Eliot Moss <moss AT cs DOT umass DOT edu> wrote:
>> On 8/22/2017 10:31 AM, Stephen John Smoogen wrote:
>>
>>> I replicated this problem on my system and found that the fix is to add a
>>>
>>> shopt -s expand_aliases
>>>
>>> at the top of the script. I don't know why the option is turned off
>>> when running scripts versus in a plain script but that seems to be a
>>> default in Cygwin.
>>
>>
>> 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.

Are you talking bash as sh or bash as bash?  Bash as sh will expand
those aliases.  But you should study
http://tldp.org/LDP/abs/html/aliases.html for all your scripts.  Are
there environment variables that could affect the outcome?

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

- Raw text -


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