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
Carbon copy for a mail in mailx command miltony Shell Programming and Scripting 11 05-15-2009 03:26 AM
How to set HIGH importance to a mail sent through mailx or sendmail command mitte_dino UNIX for Dummies Questions & Answers 3 01-29-2009 03:02 PM
Regarding mailing to a distribution list (DL) using mail/mailx command naren_0101bits Shell Programming and Scripting 1 02-06-2008 12:25 PM
unable to sent mail in html format by mailx command. p_prathaban UNIX for Advanced & Expert Users 17 11-07-2007 03:03 AM
Mail command in a shell script garric Shell Programming and Scripting 0 04-21-2006 09:59 AM

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

Join Date: Dec 2005
Posts: 4
How to use mail,mailx command in Shell Script ?

Hi..

How can i use mailx,mail [COLOR=Blue]command in Shell Script.

Suppose i gave a condition that x value is above 25 send a mail alert to abc@rediffmail.com.

How can i do this?

Regards

Sollin
  #2 (permalink)  
Old 12-22-2005
ashterix ashterix is offline
Registered User
  
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
if [ $x -gt 25 ]
then
mail -s "$x is greater than 25" abc@rediffmail.com
fi
  #3 (permalink)  
Old 12-22-2005
sollin sollin is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 4
unary operator overloaded error

#!/bin/sh
# TestMail1.sh: Sample Mail Script
val1= cut -c 27 filename
if [ $val1 -gt 25 ]
then
mail -s "$val1 is greater than 25" abc@rediffmail.com
fi

After executing above code i'm getting below error:

./TestMail1.sh: Line 4: [: -gt: unary operator overloaded

Plz anyone help me this regards
  #4 (permalink)  
Old 12-22-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
what's the value of 'val1' after the 'cut'?
  #5 (permalink)  
Old 12-22-2005
sollin sollin is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 4
val 1 value is 29
  #6 (permalink)  
Old 12-22-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Quote:
Originally Posted by sollin
val 1 value is 29
make sure it really is.
a simple test:
Code:
#!/bin/sh

val1=29

if [ $val1 -gt 25 ]
then
   echo 'greater'
fi
  #7 (permalink)  
Old 12-23-2005
ashterix ashterix is offline
Registered User
  
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
Quote:
Originally Posted by sollin
val1= cut -c 27 filename
i think u need to put ` `

val1=`cut -c 27 filename`
Closed Thread

Bookmarks

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 10:47 AM.


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