Problems with 'tail -n *'

Dave Korn
Wed Oct 29 18:09:00 GMT 2008

Gustavo Seabra wrote on 29 October 2008 17:39:

>>  The "-NNN" form is an abbreviation for "-n NNN".  If you write it out
>> in full, it works: 
>> $ tail -n 2 *.dat
> OK, I see that now. Thanks. But is there a reason why the abbreviation
> is not working in cygwin? It works just fine in a different system...

  From your original post:

> It works fine on a linux computer we have (tail (coreutils) 5.2.1).

> $ tail --version
> tail (GNU coreutils) 6.10

  So the reason is "because you're using different versions".  I would guess
that the behaviour was changed on purpose by the coreutils maintainers.
Looking at /usr/share/doc/coreutils-6.10/NEWS suggests there have been a
number of changes for POSIX conformance; and I notice:

"  In the following cases POSIX allows the default GNU behavior,
  so when POSIXLY_CORRECT is set:

  [ . . . ]

  tail supports two or more files when using the obsolete option syntax. "

  There may have been a regression arising; it doesn't seem to make any
difference to my testing if I set POSIXLY_CORRECT, or then again maybe
POSIXLY_CORRECT is defaulted on for Cygwin, because setting it on my Linux
system stops it from working and gives me an error message:

[dk@ori ~]$ export POSIXLY_CORRECT=1
[dk@ori ~]$ tail -2 *.txt
tail: too many arguments;  When using tail's obsolescent option syntax (-2)
there may be no more than one file argument.  Use the equivalent -n or -c
option instead.
[dk@ori ~]$ 

  I see Eric (the cygwin coreutils maintainer) has just sent a reply; let's
see what he has to say.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list