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: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 AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-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" To: "'Duncan Roe'" , , "'Eliot Moss'" References: <000001d31acd$108b0340$31a109c0$@rogers.com> <20170821225531 DOT GB3317 AT dimstar DOT local DOT 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 AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On > Behalf Of Duncan Roe > Sent: August-21-17 6:56 PM > To: cygwin AT cygwin DOT 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