Jump to content
 English      
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
     Forums advanced search
HP.com Home
IT Resource Center Forums > Linux > system administration

Script issue moving from HPUX to Linux for mail

» 

IT Resource Center

» Login
» Register
» My profile
» Search knowledge base
» Forums
» Patch database
» Download drivers, software and firmware
» Warranty check
» Support Case Manager
» Software Update Manager
» Training and Education
» More maintenance and support options
» Online help
» Site map

Member icons
 
 HP moderator  HP moderator
 Expert in this area  Expert in this area
Member status
ITRC Pro ITRC Pro
250 points
ITRC Graduate ITRC Graduate
500 points
ITRC Wizard ITRC Wizard
1000 points
ITRC Royalty ITRC Royalty
2500 points
ITRC Pharaoh ITRC Pharaoh
7500 points
Olympian Olympian
20000 points
1-Star Olympian 1-Star Olympian
40000 points
2-Star Olympian 2-Star Olympian
80000 points
»  How to earn points
»  Support forums FAQs
Question status
Magical answer Magical answer
Message with a response that solved the author's question
Favorites status
Add to my favorites Add to my favorites
Delete from my favorites Delete from my favorites
This thread has been closed Thread closed
 

Content starts here
   Create a new message    Receive e-mail notification if a new reply is posted  Reply to this message
Author Subject: Script issue moving from HPUX to Linux for mail      Add to my favorites
ECUse
Nov 6, 2009 19:05:04 GMT   

Hi,

I have a script that I am migrating from a HPUX system to a REDHAT 5.3 system. I am trying to insert a file as a text attachment to a message. It works in HPUX, but not in Linux. Here it is....

HPUX:
mailx -s "test" bob@aol.com << EOF
This is my e-mail text message.

~r /home/bob/log/logfile
EOF

Linux:
mail -s "test" bob@aol.com << EOF
This is my e-mail text message.

~r /home/bob/log/logfile
EOF

The problem is the ~r is seen as text in the e-mail message and not executing the function in the script under linux.

Any ideas.

Thx
Note: If you are the author of this question and wish to assign points to any of the answers, please login first.For more information on assigning points ,click here


Sort Answers By: Date or Points
Steven Schweda This member has accumulated 7500 or more points
Nov 6, 2009 19:34:56 GMT  8 pts

Apparently "mailx" on HP-UX and "mail" on
your GNU/Linux system are different programs.

> Any ideas.

Yes?

If nothing else, instead of expecting "mailx"
to do all the work, you could use "cat" (or
something) to combine your message text with
the contents of that "~r" file, and send the
result through "mail".
ECUse
Nov 6, 2009 20:03:04 GMT    N/A: Question Author

I have implemented the work around you have suggest. I know the ~r option works in Linux. It's just bugging me that I can't get it to work as it did in HPUX. If I manually type the message and add the ~r filename. It works. Just using the redirect text option it doesn't. I am wondering if there is an escape character to allow it to execute the option instead of reading it as text.
Randy Jones
Nov 7, 2009 02:01:49 GMT    Unassigned

mailx and mail are different, and the tilde trick is specific to mailx.

If you don't have /bin/mailx present on your 5.3 system, install the Linux Standard Base RPM ("yum install redhat-lsb") and several things will probably be more in line with scripts you wrote for HP-UX.
 
Create a new message    Receive e-mail notification if a new reply is posted   Reply to this message
 
 
Printable version
Privacy statement Using this site means you accept its terms
© 2009 Hewlett-Packard Development Company, L.P.