Subject: bug#11990: Tail does not behave as expected

From: Eric Blake <[email-masked]>
Date: Thu, 19 Jul 2012 10:51:55 -0600

tag 11990 notabug
thanks

On 07/19/2012 09:25 AM, Rodolfo Aramayo wrote:
> Version:tail (GNU coreutils) 8.17
> 
> Please take a look at this output:

> 
> 261$ tail -1 supercont10r12_01_wt_-fasta.gff3
> Supercontig_10.1 protein2genome:Proteins_wt match_part 9771037 9771263
> 1679 - . ID=Supercontig_10.1:hsp:281564:96_0;Parent=Supercontig_10.1:hit:143095:96_0;Target=NCU10031T0
> 239 314;Gap=M76 R1
> 
> [10:21:07][raramayo][/Volumes/g0006/00scontig101200_wt_maker/zmakerresults02]
> 
> 262$ tail -1 supercont10r12_0{1..7}_wt_-fasta.gff3
> tail: option used in invalid context -- 1
> 
> 
> This is not what I expected

Telling us what you _did_ expect will go a long way to helping us
understand what you think is the bug.  But my guess is that what is
happening is that the unquoted sequence '{1..7}' is being treated as a
shell glob that then expands into multiple file names, but we have
explicitly documented that the legacy option '-1' only works if you pass
a single file name.  From 'info coreutils tail':

"For compatibility `tail' also supports an obsolete usage `tail
-[COUNT][bcl][f] [FILE]', which is recognized only if it does not
conflict with the usage described above.  This obsolete form uses
exactly one option and at most one file."

If you want to list the last line of multiple files, you have to use '-n
1' instead of '-1'.  Therefore, I'm closing this as not a bug.  However,
feel free to continue to comment if you have further questions.

-- 
Eric Blake   [email-masked]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org