Passing multi-line arguments through c-shell

Jeremy A. Siegel jzs at bridge2.3Com.Com
Tue Jan 17 02:50:59 AEST 1989


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



More information about the Comp.unix.questions mailing list