This is the mail archive of the
mailing list for the Cygwin project.
Re: R: Cygwin 1.5 vs. 1.7: tail
- From: Julio Costa <costaju at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 28 Oct 2009 11:29:55 +0000
- Subject: Re: R: Cygwin 1.5 vs. 1.7: tail
- References: <4AE827D9.firstname.lastname@example.org>
On Wed, Oct 28, 2009 at 11:15, Roland Schwingel wrote:
> Hi Marco,
> Thanks for your reply.
Quoted e-mail edited; please see http://cygwin.com/acronyms/#PCYMTNQREAIYR
> Marco Atzeri wrote on 28.10.2009 12:05:09:
>> --- Mer 28/10/09, Roland Schwingel Âha scritto:
>> the manual says
>> tail -N +3 /path/to/some/file
> You mean
> tail -n +3 /path/to/some/file
> If ÂI do that it will work fine.
> I just wonder it this change was on purpose or not, because the other form
> (without -n) still work on other systems like mac/linux. I do share my
> scripts across several platforms. And these particular tail line haven't
> changes for ages here.
Depends on the version of tail and other GNU utilities.
Please see this excerpt from the "info tail":
Scripts intended for use on standard hosts should avoid obsolete
syntax and should use `-c COUNT[b]', `-n COUNT', and/or `-f' instead.
If your script must also run on hosts that support only the obsolete
syntax, you can often rewrite it to avoid problematic usages, e.g., by
using `sed -n '$p'' rather than `tail -1'. If that's not possible, the
script can use a test like `if tail -c +1 </dev/null >/dev/null 2>&1;
then ...' to decide which syntax to use.
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'.
The GNU utilities normally conform to the version of POSIX that is
standard for your system. To cause them to conform to a different
version of POSIX, define the `_POSIX2_VERSION' environment variable to
a value of the form YYYYMM specifying the year and month the standard
was adopted. Two values are currently supported for `_POSIX2_VERSION':
`199209' stands for POSIX 1003.2-1992, and `200112' stands for POSIX
1003.1-2001. For example, if you have a newer system but are running
software that assumes an older version of POSIX and uses `sort +1' or
`tail +10', you can work around any compatibility problems by setting
`_POSIX2_VERSION=199209' in your environment.
So, you could try this, or using the standard form, "-n NN"
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple