From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78322 invoked by alias); 22 Aug 2017 19:47:59 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 78149 invoked by uid 89); 22 Aug 2017 19:47:58 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Aug 2017 19:47:56 +0000 Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP id kF9Vdbq8z8LPZkF9WdavBM; Tue, 22 Aug 2017 13:47:55 -0600 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 Received: from www-data by kylheku.com with local (Exim 4.72) (envelope-from <920-082-4242@kylheku.com>) id 1dkF9V-0006J8-0v for cygwin@cygwin.com; Tue, 22 Aug 2017 12:47:53 -0700 To: cygwin@cygwin.com Subject: Re: alias appears to not work inside a called bash script X-PHP-Originating-Script: 501:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Aug 2017 19:47:00 -0000 From: Kaz Kylheku <920-082-4242@kylheku.com> Message-ID: <40f2498d2efcf0f5214b476c80f9cb92@mail.kylheku.com> X-Sender: 920-082-4242@kylheku.com User-Agent: Roundcube Webmail/0.9.2 X-CMAE-Envelope: MS4wfIitipIzCdhNq0WkClaQg5rPOsCAz6fdWRJWZ9/KdoVQw3cWtd7UMzk7SWsR7i1OBBIT1qILhLAf7n0FnPbvDpBQyaQeXAfrZDSTWF/afmjDRmc2X4Vl MqyzPmc47WN0ASY8rlhmNEO/T2SRXGig3l5KWuNdf6dsnN6yMA+gJ6HN X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00204.txt.bz2 On 21.08.2017 15:53, Eliot Moss wrote: > From the bash man page: >=20 > "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)." >=20 > 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=20 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