View Single Post
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: Issues emailing data from unix/sql script

 
0
  #5
Mar 27th, 2008
Hey Joe,

Looking at your output, I don't think your EOF is being matched and that's causing your issue.

For instance, I just wrote this quickly and ran it:

Shell Scripting Syntax (Toggle Plain Text)
  1. #!/bin/bash
  2.  
  3. cat <<EOF > OUTPUT
  4.  
  5. go
  6.  
  7. EOF
  8. echo hi

Shell Scripting Syntax (Toggle Plain Text)
  1. -bash-3.2$ ./eof
  2. hi

Shell Scripting Syntax (Toggle Plain Text)
  1. -bash-3.2$ cat OUTPUT
  2.  
  3. go


And everything comes out in order. I noticed in your output that the

"go"

shows up in the wrong place in your output and the file doesn't get created until after you try to send the file.

Even if I put the select statement in, I don't the same disruption in output.

What I'm thinking is it might be a character in the

(sql part)

Would it be possible to post that?

Otherwise, try this also, just in case the Here Document redirection is misinterpreting spaces and/or tabs in your script.

Change:

Shell Scripting Syntax (Toggle Plain Text)
  1. db_rawamisql $env $component <<EOF > $file

To:

Shell Scripting Syntax (Toggle Plain Text)
  1. db_rawamisql $env $component <<-EOF > $file

and see if that does anything for you. Give that a try before you make any other mods. The answer might be that simple.

Thanks for replying. Hopefully we'll get this sorted out soon

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote