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:from:to:references:in-reply-to:subject:date
	:message-id:mime-version:content-type:content-transfer-encoding;
	 q=dns; s=default; b=jDejTVyzN/wupZ4O4fagiAfP9MBLDw+MowH7RyduDX8
	EDlu2daic1G7juq9pEmpkGEOXRIppOPpx+rPff1FtN+5rEhEj/pfq2TQbgwyGMuj
	cwUZZuHcG4Rs4U2BMp+wlhvuJVk6KK3d5kjg9tkgDBPOFucQgUJMCZvs0oaamvfI
	=
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:from:to:references:in-reply-to:subject:date
	:message-id:mime-version:content-type:content-transfer-encoding;
	 s=default; bh=j1eFEw4Op5CrCii7AuMSzzh8nK0=; b=PXouiSIWRT7wJlVXX
	eQfBCqTQbDTkyPrFQaCX2z69rrwibW7+1mnVVBfsZudQ+i1fY1xLB07cAUop7MU1
	zisDSMJYY0JNusuQMGaHFWfDdLlfTQYt2UWC2JvZZcv1rmxCjxAzV2pp7DQHzQy+
	q/DBwCfByoQmKHHtD9CM6185lY=
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.8 required=5.0 tests=AWL,BAYES_20,CYGWIN_OWNER_BODY,GIT_PATCH_2,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=HTo:D*au, HTo:D*com.au, roe, Michel
X-HELO: nm10-vm5.access.bullet.mail.gq1.yahoo.com
X-Yahoo-SMTP: _oUbE.SswBCQ_d_LvSIk7sZfv6R7Is8n9OVRVjJJh3dhqEgGPCs-
From: "Michel LaBarre" <michel.labarre@rogers.com>
To: "'Duncan Roe'" <duncan_roe@optusnet.com.au>, <cygwin@cygwin.com>,
        "'Eliot Moss'" <moss@cs.umass.edu>
References: <000001d31acd$108b0340$31a109c0$@rogers.com> <20170821225531.GB3317@dimstar.local.net>
In-Reply-To: <20170821225531.GB3317@dimstar.local.net>
Subject: RE: alias appears to not work inside a called bash scripty
Date: Mon, 21 Aug 2017 21:00:38 -0400
Message-ID: <000d01d31ae2$12d70990$38851cb0$@rogers.com>
MIME-Version: 1.0
Content-Type: text/plain;	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Rats!  You are right. Thank you so much Duncan and Eliot (both for the
information and the tactful tone :-)  ).

I will review shopt  - I had been only looking at "set" for relevant
options.


> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On
> Behalf Of Duncan Roe
> Sent: August-21-17 6:56 PM
> To: cygwin@cygwin.com
> Subject: Re: alias appears to not work inside a called bash scripty
> 
> On Mon, Aug 21, 2017 at 06:30:15PM -0400, Michel LaBarre wrote:
> > Hello all,
> >
> > I have a 4 line bash script:
> >   #!/bin/bash
> >   alias nawk=gawk
> >   alias nawk
> >   nawk  'BEGIN {FS="^"} ; (length($0) > maxline) { maxline = length($0)
;
> > line=$0} ; END{print maxline, line}' $*
> >
> >
> > When I run the script I see:
> >   alias nawk='gawk'
> >  /cygdrive/c/mybin/maxline/: line 4: nawk: command not found
> >
> > It looks like the alias is properly defined but it does not appear to
take
> > effect.
> >
> > Same thing happens if I alias to awk instead of qawk.
> >
> > Same thing happens if I define the alias in .bashrc (I include an echo
in
> > bashrc to confirm that it is being invoked).
> >
> > My .bashrc is not likely a factor - I empty it and the result is the
same.
> > No carriage returns in the script or .bashrc.
> >
> > I have updated everything August 5th using setup and letting all
"Pending"
> > pkgs update so I believe I am up to date.
> >
> > The funny thing is that it works ok from an interactive session, whether
the
> > alias is explicitly defined in the session or in .bashrc.
> >
> > Thank you in advance for any insights.
> >
> > BTW - I just re-subscribed to cygwin 4-5 hours ago and have not seen any
> > mail which seems unusual based on past experience.
> >
> > Michel LaBarre
> > 613-692-0507
> >
> >
> This is expected behaviour. "man bash" gibes
> 
> " Aliases are not 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).
> 
> Cheers ... Duncan.
> 
> --
> 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


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

