delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/29/13:05:40

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: Problems with 'tail -n *'
Date: Wed, 29 Oct 2008 18:05:17 +0000 (UTC)
Lines: 36
Message-ID: <loom.20081029T180047-463@post.gmane.org>
References: <f79359b60810290733t102346a1sb33f529eaa4da778 AT mail DOT gmail DOT com> <015901c939d8$b22295e0$9601a8c0 AT CAM DOT ARTIMI DOT COM> <f79359b60810291038y38a38473uad379133258bc94f AT mail DOT gmail DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Gustavo Seabra <gustavo.seabra <at> gmail.com> writes:


> >> $ tail -2 *.dat
> 
> OK, I see that now. Thanks. But is there a reason why the abbreviation
> is not working in cygwin? It works just fine in a different system...

It may be due to how many files that glob expands to, as the obsolete syntax 
works when *.dat expands to one file, but fails when it expands to multiple 
files.

And is your different system running GNU coreutils?  The difference may also be 
due to what level of POSIX compliance the tail implementation provides.

Read 'info tail':

   For compatibility `tail' also supports an obsolete usage `tail
-[COUNT][bcl][f] [FILE]', which is recognized only if it does not
conflict with the usage described above.  This obsolete form uses
exactly one option and at most one file.  In the option, COUNT is an
optional decimal number optionally followed by a size letter (`b', `c',
`l') to mean count by 512-byte blocks, bytes, or lines, optionally
followed by `f' which has the same meaning as `-f'.
...
   Even if your script assumes the standard behavior, you should still
beware usages whose behaviors differ depending on the POSIX version.
For example, avoid `tail - main.c', since it might be interpreted as
either `tail main.c' or as `tail -- - main.c'; avoid `tail -c 4', since
it might mean either `tail -c4' or `tail -c 10 4'; and avoid `tail +4',
since it might mean either `tail ./+4' or `tail -n +4'.

-- 
Eric Blake




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019