[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tail claims "tail +n" is deprecated

From: Alfred M. Szmidt
Subject: Re: tail claims "tail +n" is deprecated
Date: Sat, 1 Jul 2006 19:57:06 +0200 (CEST)

   There's a bug in recent tail: it claims "tail +20" is deprecated
   and I should use "tail -n +20".

It isn't a bug, it is intended.  (coreutils)Standards conformance:

|    Newer versions of POSIX are occasionally incompatible with older
| versions.  For example, older versions of POSIX required the command
| `sort +1' to sort based on the second and succeeding fields in each
| input line, but starting with POSIX 1003.1-2001 the same command is
| required to sort the file named `+1', and you must instead use the
| command `sort -k 2' to get the field-based sort.

   But don't force everyone
   on the planet to update scripts that have been working just fine on
   every UNIX system for the last 35 years.

You are free to use an older version of tail, or you could as easily
disable the behaviour, (coreutils)tail invocation:

|    On older systems, the leading `-' can be replaced by `+' in the
| obsolete option syntax with the same meaning as in counts, and
| obsolete usage overrides normal usage when the two conflict.  This
| obsolete behavior can be enabled or disabled with the
| `_POSIX2_VERSION' environment variable (*note Standards
| conformance::), but portable scripts should avoid commands whose
| behavior depends on this variable.  For example, use `tail -- -
| main.c' or `tail main.c' rather than the ambiguous `tail - main.c',
| `tail -c4' or `tail -c 10 4' rather than the ambiguous `tail -c 4',
| and `tail ./+4' or `tail -n +4' rather than the ambiguous `tail +4'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]