delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/08/22/15:12:07

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=PDVDQ4WxM3Ek51qz
s1NV5MuKjkYnrgh46w+/DB/BAphC5R+bmDGYcLvxcKUm/ELjtQWdPf+Eow94okCb
YUQTXVGHHz9sAxW4/FQZ2JaOBrMeRT38NrMlOHQ32DgDiqwbUZjJhoqwUuu4uGGZ
9SffrrNqTOM7gt6NSrDrHoB7jwc=
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=fGEOgf9s6c6PnuFC5/k/mp
AtRoc=; b=U9MjrMlwNwgetIetaECU+u1j1vHasUVuGDOb9pI77ak3W02jvvB6Jo
hXE43YePsm0jWWCm/s7RhbWv56Wcr4CmOYXNBsJKfWgePG5zmDdRJe1SxkIywVpz
lYUbC7eXReBNuiBSZ9Xf13WRa6+Flrb65HOxdlU1FfwRwOejVWeTg=
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=act, his, HContent-Transfer-Encoding:8bit
X-HELO: mail-it0-f43.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=QPQrBH1/k2vCzvZZOyMLiZ6FtBq1bSemTP32cXiM1f0=; b=Icyt9rdkCpU1pTspEdxHVfBxGHfqdpHQjEGyphPM6efJOV3c+26lcoTTRa4yhxxF60 eIOTWVpt79/6ejD+PPj7plSIBHkiv9GEbTCPdg+ncl2bHQklZVlnP+Yy5M6R432qdTMb FKv7CCXiSrdLvcRr0AW3WZeaZUs6gwHcjuKYxm9imoOIZs+xZSJNsmCrK3lHQIiNTPTc /sH5zOY2D93+e3Ork3Zwga7jCM4B+V55yyWOGysNwyyeCARHIZxioWTZ2TluEbQIYwhi 756/AcxHucC2QY1fDynpbhMQ4LTOztbkpHKTASJMh2l8rwJaGwsBNZrbPvl4s19qiIW0 wM+A==
X-Gm-Message-State: AHYfb5iOoHYQ0wzK/m205JLeotWZErtP+Mp0BWbit7PWiESmsoTiKqlv yWK4GOzby/4Fbi0u
X-Received: by 10.36.134.68 with SMTP id u65mr957830itd.87.1503429106632; Tue, 22 Aug 2017 12:11:46 -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> <99262820-ed21-d20d-8da0-2c0daa29f476 AT gmail DOT com> <772ae5e5-8ed7-76c4-6d4b-cf352504a8cc AT cs DOT umass DOT edu> <78f5b6c2-c097-35bf-578d-6f3e45660e78 AT gmail DOT com>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <3b44c2b5-51a6-be9a-5732-a33d41a8bd6c@gmail.com>
Date: Tue, 22 Aug 2017 15:11:48 -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: <78f5b6c2-c097-35bf-578d-6f3e45660e78@gmail.com>
X-IsSubscribed: yes

On 8/22/2017 3:07 PM, cyg Simple wrote:
> On 8/22/2017 1:13 PM, Eliot Moss wrote:
>> On 8/22/2017 1:07 PM, cyg Simple wrote:
>>> 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:
>>
>>> 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?
>>
>> Since the OP has a #! /bin/bash line at the top of his script, I think
>> he means bash.  However, running the script with sh explicitly does act
>> as you describe, e.g.:  sh myscript x y z ... in contrast to: myscript x
>> y z.
>>
> 
> There's also --posix and set -o posix which will cause bash to perform
> as the OP reports.  I'm guessing this to be used in the bash startup
> files in a global fashion on those systems that you're not having to
> specify to use aliases.
> 
> https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html#Bash-POSIX-Mode
> 

And --enable-strict-posix-default configure option turns this setting on
by default.  I'll leave it up to the Cygwin maintainer to decide if it
should be used.

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