Bug 874 - tail -(a number) doesn't work if more than one file is named
Summary: tail -(a number) doesn't work if more than one file is named
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: textutils
Version: 5.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-01-18 23:34 UTC by Joe Harrington
Modified: 2013-08-27 18:45 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-03-23 01:45:41 UTC

Attachments (Terms of Use)

Description Joe Harrington 1999-01-18 23:34:02 UTC
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
file, otherwise,
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
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 textutils-bugs@gnu.ai.mit.edu

Comment 1 David Lawrence 1999-01-19 17:58:59 UTC
This report has been verified in the test lab to be true. You can type
for example:

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.

Comment 2 Erik Troan 1999-03-23 01:45:59 UTC
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)
     return 0;

   /* If I were implementing this in Perl, the rest of this function

Comment 3 CFME Bot 2013-08-27 18:45:51 UTC
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.

Issue #874

Change the spec's description.

Issue #874

Note You need to log in before you can comment on or make changes to this bug.