X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: Problems with 'tail -n *' Date: Wed, 29 Oct 2008 18:05:17 +0000 (UTC) Lines: 36 Message-ID: References: <015901c939d8$b22295e0$9601a8c0 AT CAM DOT ARTIMI DOT COM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 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 Gustavo Seabra 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/