LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2017, 12:42 AM   #1
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,176
Blog Entries: 30

Rep: Reputation: 669Reputation: 669Reputation: 669Reputation: 669Reputation: 669Reputation: 669
Q: quoting STDOUT from a system-call ...


Good morning.

In the context of using mutt as MTA in a procmail recipe, to create an autoresponder, I use a command-line like the following (explanations follow):

Code:
/usr/bin/mutt `formail -xFrom:` -e "my_hdr X-Loop: admin@[your domain]" -s `formail -xSubject:` -i /home/[user]/info.txt
I am in trouble, when the subject-line from the original, incoming mail contains spaces, as the second and all following words will be considered email-addresses by mutt. The mailer then creates 1 mail for each such inexistent address.

How would you solve the problem. Defining a variable $SUBJECT after the successful match with my criteria cannot change anything, as the spaces would stay intact. Mutt does apparently not expect a named parameter for the destination address and everything which is not a known command-line-option will be handled as address...

formail can act on leading and trailing spaces or line-breaks which is great but does not help.

For the time, I plan to replace all spaces in the outgoing subject-line against underlines, by use of a shell-script, which will call formail on a piped-in program-argument, or by adding another pipe
Code:
(...) `formail -z -xSubject: | tr [:blank:] _`
How would you do it?

Edit: This is not a homework question and all I describe are running routines. All I seek is perfection.

Last edited by Michael Uplawski; 08-08-2017 at 12:54 AM. Reason: AwesomeMachine. I am joking. Will explain slowly, if need be. ;-)
 
Old 08-08-2017, 08:06 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
The way you devised sounds pretty good.

Last edited by AwesomeMachine; 08-08-2017 at 08:11 AM.
 
1 members found this post helpful.
Old 08-10-2017, 04:26 AM   #3
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,176

Original Poster
Blog Entries: 30

Rep: Reputation: 669Reputation: 669Reputation: 669Reputation: 669Reputation: 669Reputation: 669
... and it appears to work flawlessly, the call to formail and the pipe to tr, I mean.

But each time, I advance in my comprehension of some mechanism, I stumble about a new glitch and discover more potential pitfalls...
The current topic is marked [Solved], but my blog-entry keeps evolving.

[Edit]: ... and it appears to work even better without all that and after I had just put double-quotes around the system-calls to formail...

We are sorry for the inconvenience” (God in the Hitchhiker's Guide To The Galaxy)

Last edited by Michael Uplawski; 08-12-2017 at 01:55 PM. Reason: Double-Quotes
 
  


Reply

Tags
formail, mutt, procmail, whitespace


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
may i know details about system call how to use system call and definition for virtua mahi rajee Programming 1 05-02-2012 07:45 AM
[SOLVED] Bash syntax - question regarding quoting: quoting doesn't work as I expect. c.stadegaart Linux - General 5 04-02-2012 11:40 PM
how to write a system call which returns current system time using call by reference mukul2kul4 Debian 2 09-25-2011 11:17 PM
calling a system call inside a system call suresh.j Linux - Kernel 1 08-03-2010 09:28 PM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration