From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31907 invoked by alias); 22 Aug 2017 01:01:15 -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 31268 invoked by uid 89); 22 Aug 2017 01:00:46 -0000 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 Received: from nm10-vm5.access.bullet.mail.gq1.yahoo.com (HELO nm10-vm5.access.bullet.mail.gq1.yahoo.com) (216.39.63.128) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Aug 2017 01:00:44 +0000 Received: from [216.39.60.168] by nm10.access.bullet.mail.gq1.yahoo.com with NNFMP; 22 Aug 2017 01:00:39 -0000 Received: from [67.195.22.118] by tm4.access.bullet.mail.gq1.yahoo.com with NNFMP; 22 Aug 2017 01:00:39 -0000 Received: from [127.0.0.1] by smtp113.sbc.mail.gq1.yahoo.com with NNFMP; 22 Aug 2017 01:00:39 -0000 X-Yahoo-SMTP: _oUbE.SswBCQ_d_LvSIk7sZfv6R7Is8n9OVRVjJJh3dhqEgGPCs- From: "Michel LaBarre" To: "'Duncan Roe'" , , "'Eliot Moss'" 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: Tue, 22 Aug 2017 01:01:00 -0000 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 X-SW-Source: 2017-08/txt/msg00191.txt.bz2 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