Red Hat Bugzilla – Bug 874
tail -(a number) doesn't work if more than one file is named
Last modified: 2013-08-27 14:45:51 EDT
Doing tail -3 gives a syntax error if more than one file is
named on the command line. Tailing multiple files without a
numeric option, and tailing one file with it, both work.
The --help documents that a form of the -n option is just to
use the number and not the letter 'n'.
% tail -1 index
-tilt 0 -vthroat 0 &
% tail -1 index.oob
plumeave l4t15o75s.fits l4t15o75sa.fits l4t15o75sb.fits
% tail -1 index index.oob
tail: invalid option -- 1
Try `tail --help' for more information.
% tail --help
Usage: tail [OPTION]... [FILE]...
Print last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving
the file name.
With no FILE, or when FILE is -, read standard input.
-c, --bytes=N output the last N bytes
-f, --follow output appended data as the file
-n, --lines=N output the last N lines, instead
of last 10
-q, --quiet, --silent never output headers giving file
-v, --verbose always output headers giving file
--help display this help and exit
--version output version information and
If the first character of N (the number of bytes or lines)
is a `+',
print beginning with the Nth item from the start of each
print the last N items in the file. N may have a multiplier
b for 512, k for 1024, m for 1048576 (1 Meg). A first
OPTION of -VALUE
or +VALUE is treated like -n VALUE or -n +VALUE unless VALUE
has one of
the [bkm] suffix multipliers, in which case it is treated
like -c VALUE
or -c +VALUE.
Report bugs to email@example.com
This report has been verified in the test lab to be true. You can type
tail -3 /var/log/messages
and it will work properly but if you type for example:
tail -3 /var/log/messages /var/log/cron
it will complain of -3 being an illegal argument. On the other hand
the logn way will work properly:
tail -n 3 /var/log/messages /var/log/cron
This problem goes back to 4.2 Red Hat.
While the patch at the end of this fixes the problem, there is comment
which makes it quite clear that only one filename should be passed to
tail when obsolete arguments are used. The Single Unix Spec only cares
about tail taking a single argument, so this matches. I'm not going
to change this, as the behavior was intended by the author.
--- tail.c.ewt Mon Mar 22 20:43:50 1999
+++ tail.c Mon Mar 22 20:44:08 1999
@@ -876,7 +876,7 @@
/* With the obsolescent form, there is one option string and at
one file argument. */
- if (argc < 2 || argc > 3)
+ if (argc < 2)
/* If I were implementing this in Perl, the rest of this function
Commits pushed to master at https://github.com/ManageIQ/cfme
Use target.class.base_model to get the correct children event that is based on the target's base model.
Change the spec's description.