[TriLUG] solved: HERE document question

Joseph Mack NA3T jmack at wm7d.net
Tue Jul 27 19:35:49 EDT 2010


On Tue, 27 Jul 2010, Kevin Hunter wrote:

> At 12:19pm -0600 Tue, 27 Jul 2010, Joseph Mack NA3T wrote:
>> cat $filename> <<\EOF
>> if [ "$count" = "0" ]
>> EOF
>
> It's been awhile since I've used Bash 2.05b (with Valhalla, I think),

it's been working quite reliably here for a decade or so. No 
need to upgrade something that's working :)

> but now you can get finer control with the backslash 
> character:
>
> cat > $filename <<EOF
>  if [ "\$count" = "0" ] ...
> EOF
>
> will do the trick.

will give it a try.

> Also of note is that it's generally cleaner to quote 
> filenames

I always do this with comparisons, incase the variable is 
blank, but I hadn't thought of it here.

> (would you /ever/ put a space in there?):

I wouldn't, but some tarballs have directories for Mac code 
with file names containing spaces, which throws my scripts 
for a loop. Not to mention filenames for pdfs I download...

> cat > "$filename" <<EOF ...
>
> And, as Shane said, I'm still not clear on exactly what 
> you wanted,

My question bombed with two of you, so the solution is to 
fix it at my end, but I couldn't think of any other way to 
put it even after it was obvious that you weren't getting 
it. For the moment I'll remember it as something that needs 
fixing.

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!



More information about the TriLUG mailing list