Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!ncar!boulder!spot!wu From: wu@spot.Colorado.EDU (WU SHI-KUEI) Newsgroups: comp.unix.wizards Subject: Re: sh(1) command substitution and here documents Message-ID: <6774@sigi.Colorado.EDU> Date: 22 Jun 88 15:06:19 GMT References: <1254@cadre.dsl.PITTSBURGH.EDU> Sender: news@sigi.Colorado.EDU Reply-To: wu@spot.Colorado.EDU (WU SHI-KUEI) Distribution: na Organization: University of Colorado, Boulder Lines: 25 In article <1254@cadre.dsl.PITTSBURGH.EDU> jack@cadre.dsl.pittsburgh.edu.UUCP (Jack Nelson) writes: > . . . an explanation of what he wants to do >What I would like to do is incorporate this calculation result into a shell >variable using the here document: > #!/bin/sh > var=`bc <scale=2 > 3 / 4 > End > ` > . . . error messages, why doen't it work etc. You don't need or want the here document. The following will do just fine: #!/bin/sh # not needed with REAL UNIX var=`bc ' scale = 2 3 / 4 quit'` The 'quit' is essential since bc keeps reading the standard input after the command have been read. Carl Brandauer ihnp4!nbires!bdaemon!carl 303-442-1731