bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: flex-2.5.31: `head -1' is obsolete, use `sed 1q' or `head -n1' inste


From: Paul Eggert
Subject: Re: flex-2.5.31: `head -1' is obsolete, use `sed 1q' or `head -n1' instead
Date: 11 Aug 2003 22:54:46 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Jim Meyering <address@hidden> writes:

> If you're concerned about some ancient version of head that doesn't
> know about the -n option, you could replace it with `sed 1q'.

I vaguely recall that SunOS 4.x had that problem.  (Bill Joy first
wrote 'head' on 1977-08-24; perhaps Sun was reluctant to mess with
perfection.  :-)  Certainly the problem still existed in BSD 'head' in
1988, as can be seen in
<http://groups.google.com/groups?selm=8807011611.AA29135%40okeeffe.Berkeley.EDU>
Also, some System V implementations circa 1993 didn't have a "head" at all; see
<http://groups.google.com/groups?selm=1993Feb4.130710.2678%40cbnewsk.cb.att.com>.

Anyway, 'sed 1q' is more portable, so I've been suggesting it to people.
Here's a patch.

diff -pru flex-2.5.31/configure.in flex-2.5.31-fix/configure.in
--- flex-2.5.31/configure.in    Tue Apr  1 08:17:51 2003
+++ flex-2.5.31-fix/configure.in        Mon Aug 11 22:28:24 2003
@@ -48,7 +48,7 @@ AC_PATH_PROG(INDENT, indent, indent)
 dnl if INDENT is set to 'indent' then we didn't find indent
 if test "$INDENT" != indent ; then
    AC_MSG_CHECKING(if $INDENT is GNU indent)
-   if $INDENT --version 2>/dev/null | head -1|grep "GNU indent" > /dev/null ; 
then
+   if $INDENT --version 2>/dev/null | sed 1q | grep "GNU indent" > /dev/null ; 
then
       AC_MSG_RESULT(yes)
    else
       AC_MSG_RESULT(no)




reply via email to

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