sh(1) command substitution and here documents

Hitoshi Aida aida at porthos.csl.sri.com
Thu Jun 23 04:18:58 AEST 1988


In article <6774 at sigi.Colorado.EDU> wu at spot.Colorado.EDU (WU SHI-KUEI) writes:
>The following will do just fine:
>
>	#!/bin/sh		# not needed with REAL UNIX
>	var=`bc '
>	scale = 2
>	3 / 4
>	quit'`

Not quite correct.  The following will do just fine:

	#!/bin/sh		# not needed with REAL UNIX
	var=`echo '
	scale = 2
	3 / 4
	quit' | bc`

"quit" can be omitted.

Hitoshi AIDA	(aida at csl.sri.com)
Computer Science Lab, SRI International



More information about the Comp.unix.wizards mailing list