The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to read email using mailx in shell script or perl jliharper Shell Programming and Scripting 4 03-23-2008 06:57 AM
Mailx in shell script (KSH) rockysfr Shell Programming and Scripting 2 07-01-2007 06:08 AM
Script to delete all mail in mailx sqloyd Shell Programming and Scripting 1 09-04-2006 07:01 PM
How to use mail,mailx command in Shell Script ? sollin Shell Programming and Scripting 16 04-28-2006 06:50 AM
unable to do mailx from shell script xiamin Shell Programming and Scripting 3 12-24-2002 03:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-22-2006
braindrain braindrain is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 67
Mailx via script

Hi,
using mailx,

cat file1 | mailx -v -R somebody@org.com -s 'This is subject message' nobody@org.com

Problem here is the subject of the email gets truncated after the first space, i.e emails are receving with subject "This" instead of "This is subject message"

any idea what is wrong ?

Thnx
  #2 (permalink)  
Old 06-22-2006
braindrain braindrain is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 67
sorry, i wasn't elobrative enough..

I call mailx from script, from command line if I use double quote I the get the subject as such, however when I use it via scripting, It's not
My script has following statement

cat $3 | mailx -v -R somebody@org.com -s $1 $2

my execution statement is

./script1.sh "This is subject message" nobody@org.com file.txt

I do get an email , however as I mentioned before the subject has only 'This' and not the full text

Last edited by braindrain; 06-22-2006 at 03:50 AM..
  #3 (permalink)  
Old 06-22-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Try this inside your script:

Code:
cat $3 | mailx -v -R somebody@org.com -s "$1" $2
Regards.
  #4 (permalink)  
Old 06-22-2006
braindrain braindrain is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 67
Grial,
I tried that already, but it didn't help, double quote to variable makes sures variables read as variables(??).
  #5 (permalink)  
Old 06-22-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
what is the version of mailx you are using and under which OS ?

In solaris 5.9 mailx 5.0 there isnt any option with '-R' !!!
  #6 (permalink)  
Old 06-22-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
I've tested the code (Debian Linux + bash) I posted and worked.
I don't know what could be the problem...
Try "echo $1" inside the script to see what's its value...

One more thing. As matrixmadhan, my mailx does not accept "-R"...
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0