bug-coreutils
[Top][All Lists]
Advanced

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

Re: head and tail command


From: Eric Blake
Subject: Re: head and tail command
Date: Thu, 20 Apr 2006 06:02:58 -0600
User-agent: Thunderbird 1.5 (Windows/20051201)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Subbalakshmi R. on 4/19/2006 11:11 PM:
> I have found that when we do not give the count and the file name in the
> head command in linux, it does not throw an error. Instead, it gives you
> space to enter text and when you enter the text is copied once into that
> line and further empty lines appear until we press ctrl + d.

Thanks for the report.  However, this is expected behavior.  I would
suggest rereading 'head --help', which states:

Usage: head [OPTION]... [FILE]...
...
With no FILE, or when FILE is -, read standard input.

Note that file arguments are optional.  If you are invoking head or tail
from an interactive shell alone on the command line, then stdin is the
terminal, which explains why the program waits for you to type lines
followed by ctrl-d to mark end of file.  This behavior is useful so that
you can change stdin with shell redirection - for example, it is common to
do something like 'tail --help | head', so that the stdin for the head
command is now the pipe output from tail rather than the terminal.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFER3hy84KuGfSFAYARApG0AKCPXgr4L+Lndhkimm29/srJOpPgkQCfTaPX
4omVSHUKk6Ky3OwXDQbIM9Y=
=EkCH
-----END PGP SIGNATURE-----




reply via email to

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