[PATCH] Use POSIX standardized options for head(1) and tail(1)

Mark D. Baushke mdb at juniper.net
Sun Apr 26 18:24:56 AEST 2020


Michael Forney <mforney at mforney.org> writes:

> Indeed, that's what motivated the patch. The version of tail on my
> system does not support the legacy options.

I suspected as much. Which system are you using?

> Another possibility is `sed 2q`, which works for any number. It's even
> mentioned in the rationale section as a way to simulate head(1).

Yes, "sed 2q" should also work fine on all versions of sed I have ever
used.

> >    tail +3 == tail -n +3 == sed '1,2d'

This may also be written as "sed -n '3,$p'" if you want to just print
the lines you want rather than deleting the lines you do not want.

> I think this script is only necessary to rebuild the .depend file,
> which is not usually necessary, but you make a good point. I didn't
> realize that some implementations did not support the -n option. The
> change you suggested sounds good to me.

Most of those systems that do not support POSIX head and tail are very
ancient... I just no longer recall which ones they were... It has been a
long time since I have seen one, but I would rather not see it break if
there is a way to be compatible for all other systems.

	Be safe, stay healthy,
	-- Mark


More information about the openssh-unix-dev mailing list