OFB Community Mailing Lists

The following archives are provided as a public service to the community. Opinions archived here do not necessarily represent the opinions of Open for Business or its contributors.

[CS-FSLUG] shell script trivia

Frank Bax fbax at sympatico.ca
Fri Oct 15 11:49:45 EDT 2004


At 11:46 AM 10/15/04, Josiah Ritchie wrote:

>On Fri, 15 Oct 2004 09:59:58 -0400
>Frank Bax <fbax at sympatico.ca> wrote:
>
> > Sometime ago I wrote an application in php.  Shortly thereafter it was
> > decided that some of the reports should be emailed to users on a regular
> > basis (a good job from cron).  The server wasn't configured to run php
> > from command line, so I used "lynx -source" to get the report out of
> > application and "attach" to an email message.  Because I wanted some info
> > from database in the subject line, it was easier to modify the php
> > scripts to supply everything I needed (mail headers, mime headers) so
> > that I could simply pipe the lynx output to sendmail with:
> >       lynx -source http://domain.com/report.php?id=22 | sendmail -i -t
> > But the version of php on my recently upgraded server includes a blank
> > line at the beginning of file that wasn't there in old version and
> > sendmail is now complaining.  I know the problem isn't with lynx because
> > running my script from old server to retrieve php report from new server
> > also fails.
> >
> > Is there an existing command I can use to strip off that first line?
>
>Something like
>
>lynx -source http://domain.com/report.php?id=22|grep -v ^$|sendmail-i -t
>
>should work shouldn't it. Since it's HTML any other blank lines can be
>removed also. I tested it with this
>cat /etc/samba/smb.conf|grep -v ^$
>
>I use the command
>cat /etc/samba/smb.conf|grep -v ^$|grep -v ^#
>to clean up config files before I share them with others.


Except that the records for mime attachments have some required blank lines.




More information about the Christiansource mailing list
Home About Connect: Twitter Facebook RSS
© 2001-2011 Universal Networks, All Rights Reserved. Some content rights may be held by Universal Networks' providers and used under license. Powered by ServerForest and SAFARI. Learn about our privacy policy here.