From: Sven Mascheck on 13 Jun 2010 08:13 Chris F.A. Johnson wrote: > [printf] > It's a builtin in all the most common shells: bash, ksh93, dash, > BSD's sh. Only on NetBSD (ash variant), but not FreeBSD (ash variant) since ~5.0 or OpenBSD (pdksh). And not in ksh88 (might still count as common shell).
From: Randal L. Schwartz on 13 Jun 2010 20:47 >>>>> "Seebs" == Seebs <usenet-nospam(a)seebs.net> writes: Seebs> "Relatively recent", it turns out, appears to be upwards of Seebs> twenty years ago. Tru64, OSF/1, Solaris, BSD, Linux, you name Seebs> it. It helps, of course, that it's a built-in in at least one Seebs> common shell. Since I started working with Unix in 1977, I *do* consider 1990 to be "relatively recent". :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: Seebs on 13 Jun 2010 23:01 On 2010-06-14, Randal L. Schwartz <merlyn(a)stonehenge.com> wrote: >>>>>> "Seebs" == Seebs <usenet-nospam(a)seebs.net> writes: >Seebs> "Relatively recent", it turns out, appears to be upwards of >Seebs> twenty years ago. Tru64, OSF/1, Solaris, BSD, Linux, you name >Seebs> it. It helps, of course, that it's a built-in in at least one >Seebs> common shell. > Since I started working with Unix in 1977, I *do* consider 1990 > to be "relatively recent". :) To some extent, I do too, but in terms of portability, in practice, I really haven't cared about stuff that old in a long time. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Tobiah on 29 Jun 2010 12:43 > k=1 > if [ k != 0 ] ; then > cat <<-EOF > Hello World. > EOF > fi > > test_eof.ksh[2]: 0403-057 Syntax error at line 2 : `<' is not matched. I don't think anyone has actually solved your problem. There are two errors. One, is that -EOF does not match EOF. The other, is that you are actually trying to match "\tEOF" at the end. So: k=1 if [ k != 0 ] ; then cat << EOF Hello World. EOF fi Hello World. You probably don't want the tab in front of 'Hello World' either. Toby
From: Ben Finney on 29 Jun 2010 19:19
Tobiah <toby(a)rcsreg.com> writes: > > k=1 > > if [ k != 0 ] ; then > > cat <<-EOF > > Hello World. > > EOF > > fi > > > > test_eof.ksh[2]: 0403-057 Syntax error at line 2 : `<' is not matched. […] > There are two errors. One, is that -EOF does not match EOF. > The other, is that you are actually trying to match "\tEOF" > at the end. The above 'cat' command is using the '<<-' operator, and the delimiter word is 'EOF'. From the SUSv7 specification for “Here Documents”: The redirection operators "<<" and "<<-" both allow redirection of lines contained in a shell input file, known as a "here-document", to the input of a command. […] If the redirection symbol is "<<-" , all leading <tab> characters shall be stripped from input lines and the line containing the trailing delimiter. If more than one "<<" or "<<-" operator is specified on a line, the here-document associated with the first operator shall be supplied first by the application and shall be read first by the shell. <URL:http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04> -- \ “Never express yourself more clearly than you are able to | `\ think.” —Niels Bohr | _o__) | Ben Finney |