delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/28/06:30:43

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4AE827D9.4060505@onevision.de>
References: <4AE827D9 DOT 4060505 AT onevision DOT de>
From: Julio Costa <costaju AT gmail DOT com>
Date: Wed, 28 Oct 2009 11:29:55 +0000
Message-ID: <af075b00910280429v9571299w26e2b34d0ce8fce0@mail.gmail.com>
Subject: Re: R: Cygwin 1.5 vs. 1.7: tail
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Hi Roland,

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 =C2=A0ha scritto:
>>
>> the manual says
>> tail -N +3 /path/to/some/file
> You mean
> tail -n +3 /path/to/some/file
> If =C2=A0I 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'.
---

Or this:

---
   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=3D199209' in your environment.
---

So, you could try this, or using the standard form, "-n NN"

___________
Julio Costa

--
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

- Raw text -


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