X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX187z3DwxgsvA/t5rgFmE5Pe Date: Wed, 13 Feb 2013 12:57:45 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Expanding @-pathnames from Cygwin bash Message-ID: <20130213175745.GC4176@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Wed, Feb 13, 2013 at 05:47:19PM +0000, Adam Dinwoodie wrote: >The UG states > >> Cygwin programs expand their arguments starting with "@" in a special way. If >> a file pathname exists, the argument @pathname expands recursively to the >> content of pathname. >-- http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-at > >It then contrasts "the behaviors of the bash built-in echo and of the program >/bin/echo." The implication I read is that the bash built-in echo doesn't >expand @-arguments because it's a built-in, not a fully-fledged program. > >However, this doesn't seem to be what's happening. Running on my Cygwin system: > $ echo 'Hi' >testfile > $ echo 'Hi testfile' >args > $ type grep > grep is hashed (/usr/bin/grep) > $ grep @args #This hangs until I hit ^C, waiting for input > > $ echo '@args' | grep @args #This shows grep looks for the literal string "@args" > @args > $ cmd > Microsoft Windows [Version 6.1.7601] > Copyright (c) 2009 Microsoft Corporation. All rights reserved. > > C:\>c:\cygwin\bin\grep @args > c:\cygwin\bin\grep @args > Hi > >By my reading of the UG, since grep is a Cygwin program, it should always >expand "@args" to the contents of the "args" file. However this doesn't seem >to happen when grep is run from within bash, only within the Windows shell. > >I think this is an error in the UG: my first guess is this behaviour is only >invoked when the parent process isn't a Cygwin process. If so, the UG >shouldn't explain the behaviour in the example as being due to echo being a >bash built-in; that behaviour also occurs if you invoke echo.exe. Right. That web page says: "To circumvent the limitations on shell line length in the native Windows command shells..." '@' parsing only happens when the Cygwin program is started from a non-Cygwin program, e.g., CMD.EXE. I've changed the docs to make it a little clearer. This will show up on the web site eventually. cgf -- 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