[TriLUG] solved: HERE document question

Shane O. shaneodonnell at gmail.com
Tue Jul 27 15:04:58 EDT 2010


I'm taking solace in the fact that my lack of understanding of the answer is
strongly rooted in my lack of understanding of the original question.

Glad you got your fix -

Shane O.

On Tue, Jul 27, 2010 at 2:19 PM, Joseph Mack NA3T <jmack at wm7d.net> wrote:

> On Mon, 26 Jul 2010, Kevin Hunter wrote:
>
>  Since no one seems to be stepping forward with a "Here's your answer,
>> Joe!", may I suggest you post your script in it's entirety to a pastebin
>> service, and let folks take a look.  Explanations are great, but sometimes
>> there's no substitute for code.
>>
>
> I did it by brute force. I needed the generating script to sometimes
> substitute the value of a variable in the HERE document. You do this with
>
> partition=/dev/sda1
> cat > $filename <<EOF
>        echo "$partition"
> EOF
>
> when $filename will contain
>
> echo "/dev/sda1"
>
> Sometimes I needed the name of the variable, and not the value, in the HERE
> document. You do this with
>
> cat $filename> <<\EOF
>        if [ "$count" = "0" ]
> EOF
>
> when $filename will contain
>
>        if [ "$count" = "0" ]
>
> I couldn't find any finer control of whether a variable would be
> substituted or written as is. I wrote the generating script to piecewise
> output strings as 5 separate HERE documents (some with variables substituted
> and some wrtten literally) which were cat'ed into the final file.
>
> Thanks Joe
>
> --
> Joseph Mack NA3T EME(B,D), FM05lw North Carolina
> jmack (at) wm7d (dot) net - azimuthal equidistant map
> generator at http://www.wm7d.net/azproj.shtml
> Homepage http://www.austintek.com/ It's GNU/Linux!
> --
> This message was sent to: Shane O. <shaneodonnell at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> http://www.trilug.org/mailman/options/trilug/shaneodonnell%40gmail.com
> TriLUG FAQ          :
> http://www.trilug.org/wiki/Frequently_Asked_Questions
>



More information about the TriLUG mailing list