sh(1) command substitution and here documents
Chris Torek
chris at mimsy.UUCP
Tue Jun 28 03:22:11 AEST 1988
In article <1254 at cadre.dsl.PITTSBURGH.EDU> jack at cadre.dsl.PITTSBURGH.EDU
(Jack Nelson) writes:
>... using [a] here document:
> #!/bin/sh
> var=`bc <<End
> scale=2
> 3 / 4
> End
> `
>But this doesn't work; an error message "cannot open /tmp/sh01383"
>always is produced, both on 4.3 and 2.10 systems. Is there a way
>to do this? Can one deduce this behavior from the manual?
It is almost noted in the BUGS section:
If << is used to provide standard input to an asynchronous
process invoked by &, the shell gets mixed up about naming
the input document. A garbage file /tmp/sh* is created, and
the shell complains about not being able to find the file by
another name.
Given this, the error message above, and the fact that a garbage
file is created, you can guess what is happening.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list