[comp.unix.questions] Passing multi-line arguments through c-shell

jzs@bridge2.3Com.Com (Jeremy A. Siegel) (01/17/89)

How can I get a c-shell script to pass multi-line terminal input as a 
single argument to a program?  Specifically: using Suns running SunOS 3.5
we use a script to admin files in sccs; I want to add use of the -y option
to insert an initial comment.  The -y works fine from the command line, 
using "" to delimit the string and \ to escape the newlines -- but I want
to get user input as the line comment strings.  I tried: ... -y"$<" ...
but that only reads one line.  I tried: ... -y"`cat`" ... but the output 
from cat contains newlines which break the string, and embedding \ didn't
seem to do any good.  I've finally ended up with:

... -y"`echo 'comments (end w/EOF(^D)): '; cat | tr '\012' ' '`" ...

which of course makes everything a single line -- which seems to work, but
doesn't look real pretty in the s-file (I don't know if there's an sccs 
limit on the line length -- I'd probably encounter a csh limit first).

Various combinations of backquotes, double-quotes, and parens with echo
and cat never quite produced what I want -- in all cases the c-shell would
not pass newlines in the option string.  So is there any way I can do this?

Thanks,
   Jeremy Siegel
   3Com Corp; ESD
   Mountain View, CA

chris@mimsy.UUCP (Chris Torek) (01/18/89)

In article <259@bridge2.3Com.Com> jzs@bridge2.3Com.Com (Jeremy A. Siegel)
writes:
>How can I get a c-shell script to pass multi-line terminal input as a 
>single argument to a program?

By using an sh script instead.

>... I tried: ... -y"`cat`" ...

Works fine with sh; but csh has serious problems with newlines, and
converts them to spaces instead.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris