passing variable to script

scooter6 at gmail.com scooter6 at gmail.com
Thu Oct 7 10:10:31 PDT 2010


  Well, I added at the end:

         Then:  write deb; end

@done Then:  system "do_my_script"<fd

 This works - and emails the file with no problem using my mutt script
(which uses sendmail)

 Problem is, the text file attachment isn't complete??  It quits on the 30th
record, about mid-way thru.

 So I vi the text file on the SCO box and all 44 records are in the file I'm
sending?????

 So I tried putting a sleep 100000 command right before the system call, but
still same issue.

 Any idea why it doesn't send me the whole file??
 Very strange......

 My mutt script looks like this:

 #!/bin/sh

cd /appl/fpmerge  (<--- this is where the file (fd) gets created)

FLE=$1

mutt -s "File you created is attached" -a $FLE my_email at ..... <
mailbody.txt   (<--- mailbody.txt is just a generic text file saying "file
attached")

Would it make a difference if root or filepro owns the mutt script?  (I'm
going to try to change that and run it again now)

Thanks guys

I knew it was something pretty obvious - just couldn't think of what it was
- brain dead lol

Scott




On Thu, Oct 7, 2010 at 12:59 PM, Brian K. White <brian at aljex.com> wrote:

> On 10/7/2010 11:34 AM, scooter6 at gmail.com wrote:
>  > I have an export ascii out put processing script that I want to setup
> to
> > email after it finishes.
> >
> > Currently, in output processing, I use variables to create filename based
> on
> > today's date, etc and that all works fine
> >
> >
> > Then:  export ascii deb=(fd) r=\n f=|
> >
> > Then: deb(1)=1, etc, etc, etc
> >
> > Then: write deb; end
> >
> > Now, after this finishes with all the records selected via set selection,
> I
> > want to email the file, passing the variable filename to the script
> >
> > I thought easiest way would be to do a system call at the end, but if I
> > change
> >
> > Then: write deb; end
> > to
> > Then: write deb
> >
> > Then: system "path_to_my_script"<  fd
> >
> > obviously this calls the system call after each record is written to the
> > file - resulting in numerous emails of course haha
> >
> > So, my next thought would be from the menu, to script it as:
> >
> > /u/appl/fp/rreport ............
> > cd /appl/fpmerge
> > ./script_name_to_send_email  ???????
> >
> > So how would I get the filename (fd) as defined in processing, passed to
> the
> > email in the Create Script File (F5) in the define menus??
> >
> > Either that, or how do I do a system call ONLY after all records have
> been
> > written to my output file??
> >
> > Thanks for any help
>
>
> My suggestion for the most self-contained and thus portable and
> maintainable way:
>
> Do the post-processing (send the email in this case) in @done.
> This means declare fd with ,g so that it is still available in @done.
> And since in this case the value in fd doesn't change during the entire
> run and doesn't depend on any record data, and assuming you have fp 4.8
> or newer, the simplest and best place to declare and fill fd is in
> @once. (no need to check "i did/didn't do this already" on every record)
>
> Lastly, to avoid possible permissions problems, You might need to use a
> system command to create the file before allowing fp to create it.
> Again, best in @once.
>
> top of prc
>  normal per-record output processing
>  [...]
>  end
>
> @once:
>  fd(32,*,g) = "/tmp/something.txt" ' don't use rand()!
>  ' system "umask 0 ; >" < fd  ' may not need, try without first.
>  end
>
> @done:
>  close deb
>  system "..." < fd
>  x = remove(fd)
>  end
>
>
>
> This way requires no special set up before nor after running
> report/clerk. It's all within the processing table.
>
> --
> bkw
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20101007/3d4fc5d6/attachment.html 


More information about the Filepro-list mailing list