On Thu, Sep 19, 2013 at 8:53 PM, FELLIN, JEFFREY K (JEFF)
<[email protected]> wrote:
> When I test printf "foo" >bar there is no newline in the file:
> $ printf "foo" >bar
> $ od -bc bar
> 0000000 146 157 157
>           f   o   o
> 0000003
>
> So if head -1 is suppose to print the first line, there is no end of line, 
> hence to no line. Given the definition of head prints lines, wouldn't a file 
> containing no newline chars, not have any output from head?

One counterargument may be that we're talking about the "last line",
which may/should be always printed, regardless whether it has a
newline or not.

The other issue is that I can't find a head(1) implementation which
behaves like AST head(1) with Irek's example:
On Solaris 10 (/usr/bin/head is the natiev SystemV implementation, not
the head(1) from AST) I get this:
-- snip --
$ bash -c 'printf "foo" >bar ; /usr/bin/head -1 bar ; printf '\n''
foo
$ bash -c 'printf "foo" >bar ; /usr/gnu/bin/head -1 bar ; printf '\n''
foo
$ bash -c 'printf "foo" >bar ; /usr/bsd/bin/head -1 bar ; printf '\n''
foo
-- snip --

On SuSE/Linux I get this for GNU coreutils and busybox head(1):
-- snip --
$ bash -c 'printf "foo" >bar ; /usr/bin/head -1 bar ; printf '\n''
foo
$ printf "foo" >bar ; busybox head -1 bar ; printf '\n'
foo
-- snip --

Erm... this looks pretty much uniform... ;-/

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to