bug-coreutils
[Top][All Lists]
Advanced

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

Re: tail: -v: No existe el fichero o el directorio


From: Paul Eggert
Subject: Re: tail: -v: No existe el fichero o el directorio
Date: Fri, 12 Nov 2004 12:09:28 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Ramírez Sánchez-Escobar José Julio <address@hidden> writes:

> medusa1.cbm.uam.es 84% head -{1,v} 2_md6_cool_min.outmd ; tail -{1,v} 
> 2_md6_cool_min.outmd
> ==> 2_md6_cool_min.outmd <==
>
> tail: -v: No existe el fichero o el directorio
> ==> 2_md6_cool_min.outmd <==
> |     wallclock() was called  390080 times
>
> Message error but it works:
> tail: -v: No existe el fichero o el directorio

It may look like a bug, but it's needed for compatibility with
traditional UNIX, where "tail -1 -v" reads the file named "-v".
For example, on Solaris 8:

   $ echo foo >-v
   $ tail -1 -v
   foo

"head" doesn't have this compatibility problem, so it behaves in
the way you expected.

Partly because of this problem, POSIX-2001 says that "head -1" and
"tail -1" are obsolete and no longer need to be supported.  This would
suggest that you should use "head -n 1" and "tail -n 1" instead, as
these forms are blessed by POSIX.  Alas, some systems still don't
support these forms, so in practice you need to use more-portable
variants like "sed 1q" and "sed -n '$p'" instead.  It's a bit of a
mess.




reply via email to

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