Warren L Dodge <[EMAIL PROTECTED]> writes:

> On the two solaris systems the following command works.
>   tail -1 file
> On linux is complains and says to use
>   tail -n 1 file
> Any idea what caused this?

It's because your GNU/Linux systems have <unistd.h> that claim
conformance to POSIX 1003.1-2001, whereas your Solaris systems claim
conformance to POSIX 1003.2-1992.  The new POSIX standard disallows
support for "tail -1" and head -1" (even as extensions!).


[EMAIL PROTECTED] (Bob Proulx) writes:

> You mean on solaris using which set of utilities?  My understanding is
> that you now have three to choose from there.
> 
>   /usr/bin/tail
>   /usr/xpg4/bin/tail
>   /usr/local/bin/tail  # Wherever you installed the GNU version.

There's also /opt/sfw/bin/gtail on Solaris 8, with the companion CD installed.
(Isn't Solaris wonderful?  They have everything!  :-)

>   export _POSIX2_VERSION=199209

This will work for coreutils, but it might not work for other
implementations that conform to POSIX 1003.1-2001.

If the original poster wantes his scripts to be portable among both
new and old systems, his best bet is stick to the compatible
intersection of POSIX and widely-used platforms.  Thus, he can replace
"tail -1" with "sed -n '$p'", and replace "head -1" with "sed 1q".
Admittedly this is a hassle in the short run, so setting
_POSIX2_VERSION=199209 may be his best bet in the short run.


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to