Subject: Re: This has GOT to be a bug in ksh...
To: <>
From: David Laight <david@l8s.co.uk>
List: netbsd-users
Date: 06/21/2002 21:36:46
On Fri, Jun 21, 2002 at 07:42:33PM +0700, Robert Elz wrote:
>     Date:        Wed, 19 Jun 2002 20:20:12 +0100
>     From:        David Laight <david@l8s.co.uk>
>     Message-ID:  <20020619202012.C343@snowdrop.l8s.co.uk>
> 
>   | There are very few shell scripts that actually have variables (etc)
>   | with real '\' in them.
> 
> Do you people never generate troff (or TeX for users of that) from
> sh scripts?

Not using echo!
It is generally easiear to use 'here' documents if you want
largish chuncks of text.

OTOH I found this INSIDE a 'here' document.....

`echo \$form | tail +$menu_page | head -$max_lines`

'form' is set up elsewhere in the script eg:
eval form=\"\${form}2 \$${opt}_count$choice\${${opt}_name}://\${brd}_\${unit}_\${opt}//\\n//Right/Left arrow keys for new choice \(\$${opt}_count choices\)//\\n\"

The same script has the following construct:

    eval `<program> | while read <args>
    do
	...
	eval case "$driver" in \
	- \| unused \| $drv \) \
	    old_ppa= \
	    \;\; \
	no_driver $old_drv \) \
	    old_ppa=${driver}_\\${${driver}_unit} \
	    \;\; \
	\* \) \
	    echo ${brd}_units=${unit}\\\\\; \; \
	    continue\;\; \
	esac
	...
    done`

This had to run with a traditional SVR4 sh.
(this is the script that made me learn all about IFS and eval.)

	David

-- 
David Laight: david@l8s.co.uk