From owner-freebsd-chat Mon Apr 17 19:46:52 2000 Delivered-To: freebsd-chat@freebsd.org Received: from mail.hiwaay.net (fly.HiWAAY.net [208.147.154.56]) by hub.freebsd.org (Postfix) with ESMTP id 0716137B7EE for ; Mon, 17 Apr 2000 19:46:48 -0700 (PDT) (envelope-from sprice@hiwaay.net) Received: from localhost (sprice@localhost) by mail.hiwaay.net (8.10.1/8.10.1) with ESMTP id e3I2kah00543; Mon, 17 Apr 2000 21:46:36 -0500 (CDT) Date: Mon, 17 Apr 2000 21:46:36 -0500 (CDT) From: Steve Price To: Paul Richards Cc: freebsd-chat@freebsd.org Subject: Re: Un*x scripting magic In-Reply-To: <38FBCA3C.46380367@originative.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, 18 Apr 2000, Paul Richards wrote: # > Then I have a multi-line (printable characters only) ASCII # > text file containing the message that I'd like to replace # > for %%MESSAGE%%. [1] Anyone have a neat little trick in # > their bag-o-magic? I know the answer should be really # > obvious but everything I've tried thus either hasn't worked # > or was too convoluted. # # What's wrong with the obvious? It doesn't embed the text in the script. So everytime I execute the script I have to re-read the file. # open(MESSAGE, $MESSAGE) || die; # while () { # $msg .= $_; # } # # You can probably optimise that a bit, read the whole file in one go for # starters. As someone else pointed out something like this would work if I didn't want to embed the content within the code in its final form yet keep them separate while they are in CVS. :) $msg = `cat foo`; -steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message