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
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".
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.
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.