sh(1) command substitution and here documents
William E. Davidsen Jr
davidsen at steinmetz.ge.com
Thu Jun 23 03:27:23 AEST 1988
In article <1254 at cadre.dsl.PITTSBURGH.EDU> jack at cadre.dsl.pittsburgh.edu.UUCP (Jack Nelson) writes:
| What I would like to do is incorporate this calculation result into a shell
| variable using the 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?
This was fixed after V7. It works in SysIII sh, SysV sh, ksh, and sh
on Sun (which is mostly sysV I believe). It fails on V7 and every BSD
version I could try. Since Berkeley hasn't fixed it (and some similar
problems) perhaps you can get ksh.
--
bill davidsen (wedu at ge-crd.arpa)
{uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
More information about the Comp.unix.wizards
mailing list