LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-05-2010, 01:25 PM   #1
rexgoode
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Angry Email Aliases Arguments


I have an email alias and I want to capture some items in the email body and put it in a database.

I'm using Linux and Bash.

In /etc/aliases I have:
bexpense: "|/usr/bin/bexpense"
In /usr/bin/bexpense, I have:
#!/bin/bash

echo $1 $2 >> bexpense.out
If I just run /usr/bin/bexpense with as "bexpense test test" I get "test test" in bexpense.out.

If I send email to bexpense@myserver.com, I get a blank line in bexpense.out.

How do I get the subject and body of the email?
 
Old 07-05-2010, 01:47 PM   #2
nuwen52
Member
 
Registered: Feb 2009
Distribution: Debian, CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 208

Rep: Reputation: 46
$1 and $2 are command line arguments. When you pipe something to a program, it does not go in as a command line argument. Instead, it is entered through the program/script stdin file descriptor. Search Google for "read stdin bash", that should help.

Last edited by nuwen52; 07-05-2010 at 02:01 PM.
 
Old 07-05-2010, 08:02 PM   #3
rexgoode
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up

That helps a lot! Thanks! Got it solved.
 
  


Reply


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
tricky syntax for passing arguments in csh aliases frerejacques Programming 1 03-23-2009 03:20 PM
Not stoping spam emails on Aliases email address talat Linux - Software 1 07-15-2008 01:26 AM
Email Kmail Thunderbird and aliases Bigglesworth Linux - General 11 01-15-2005 01:22 PM
Email and aliases gomez Linux - Software 1 01-14-2005 01:50 PM
Email Aliases in Mozilla Thunderbird? shishimo Linux - Software 2 06-22-2004 02:06 PM


All times are GMT -5. The time now is 04:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration