Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-05-2010, 02:25 PM   #1
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:

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, I get a blank line in bexpense.out.

How do I get the subject and body of the email?
Old 07-05-2010, 02:47 PM   #2
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 03:01 PM.
Old 07-05-2010, 09:02 PM   #3
LQ Newbie
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up

That helps a lot! Thanks! Got it solved.


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 04:20 PM
Not stoping spam emails on Aliases email address talat Linux - Software 1 07-15-2008 02:26 AM
Email Kmail Thunderbird and aliases Bigglesworth Linux - General 11 01-15-2005 02:22 PM
Email and aliases gomez Linux - Software 1 01-14-2005 02:50 PM
Email Aliases in Mozilla Thunderbird? shishimo Linux - Software 2 06-22-2004 03:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:19 AM.

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