[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail claims "tail +n" is deprecated
From: |
Raphael Manfredi |
Subject: |
Re: tail claims "tail +n" is deprecated |
Date: |
Sat, 1 Jul 2006 20:32:02 +0200 |
User-agent: |
Mutt/1.5.6+20040722i |
Hi Alfred,
Thanks for the quick reply. The subject seems to have been beaten to
death already, as I've learned, so let's not restart a flame war.
Quoting Alfred M. Szmidt:
: 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.
This is breaking old scripts gratuitously.
: 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'.
Relying on environment variables to change the behaviour of commands
is evil and should be avoided.
The problem is that "portable scripts" (e.g. Configure-type scripts)
were written years ago and are going to break now. I understand the
intent, but for STANDARD legacy commands dating from UNIX v7, changing
the old syntax is just asking for portability troubles.
Does the P of POSIX really mean "Portable"? I kind of wonder now. :-)
Raphael