www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/08/22/15:48:34

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:to:subject:mime-version:content-type
:content-transfer-encoding:date:from:message-id; q=dns; s=
default; b=AUbRFwHOeAtIbb6mLqpxCclHaKYjpuqcDbyUBdRKxfS8vY0GTrq25
huICWFLTMs5MCdctL4ALmX4Uq8DW/oYogsg6Iiv59BCLbbf3vTe0skFKaWRuGTfN
HVP4k8SOGv7+66Ewys2L4LVaXGBlFBR0la9YkPsRH2YBoISaQXusZA=
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:to:subject:mime-version:content-type
:content-transfer-encoding:date:from:message-id; s=default; bh=L
KXDJLzSPTvHODz3MOrObuj4fU8=; b=S8ysOK8zkKc1xZXqYBNLP3XV7CG2lhiqp
GkUzv6DiVScte/z5DCl4xLFqyjNRZwEKF/QxFu0hwLUtJLbbiiB5FAPenRSlmab8
L5PWINGYXB/eqfQT7h8EZfihzQ97Wwnpw97x8B0F6gMe3xrIrFcLrnYAnRHeptjM
X4ScUkWQYw=
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.8 required=5.0 tests=AWL,BAYES_00,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=highly
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=e552ceh/ c=1 sm=1 tr=0 a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=KeKAF7QvOSUA:10 a=jc-cTcUrzEZrfcgxf1EA:9 a=QEXdDO2ut3YA:10
To: cygwin AT cygwin DOT com
Subject: Re: alias appears to not work inside a called bash script
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Date: Tue, 22 Aug 2017 12:47:52 -0700
From: Kaz Kylheku <920-082-4242 AT kylheku DOT com>
Message-ID: <40f2498d2efcf0f5214b476c80f9cb92@mail.kylheku.com>
X-Sender: 920-082-4242 AT kylheku DOT com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfIitipIzCdhNq0WkClaQg5rPOsCAz6fdWRJWZ9/KdoVQw3cWtd7UMzk7SWsR7i1OBBIT1qILhLAf7n0FnPbvDpBQyaQeXAfrZDSTWF/afmjDRmc2X4Vl MqyzPmc47WN0ASY8rlhmNEO/T2SRXGig3l5KWuNdf6dsnN6yMA+gJ6HN
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v7MJmXL8003935

On 21.08.2017 15:53, Eliot Moss wrote:
> From the bash man page:
> 
> "Aliases are  ot expanded when the shell is not interactive, unless
> the expand_aliases shell option
> is set using shopt (see the description of shopt under SHELL BUILTIN
> COMMANDS below)."
> 
> Could that be the root of your difficulty?

There is an issue there (though not for the Cygwin project).

I don't see where this behavior is required in POSIX: that is,
expanding aliases in interactive mode, but ignoring them in 
non-interactive
operation.

POSIX seems to unequivocally be calling for Alias Expansion to occur
under all conditions.

And, indeed, this is not a bug in Bash; they know that this is
a POSIX deviation. Because, voila, aliases *are* expanded in
script mode if we do one of two things:

    #!/bin/bash --posix

    #!/bin/sh

Bash in POSIX mode knows every well that it had better
expand aliases regardless of non-interactive operation.

However, *suppressing* a useful behavior in a default, non-standard
mode is highly counter-intuitive.

I mean we can't even call this a vendor *extension* with a straight
face. What do we call this? "retraction?" :)

"To disable the vendor-specific retraction that aliases don't
work, operate bash in POSIX mode, or use the expand_aliases
shopt."

:)


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