|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Email Attachment Script
Hello,
I created the following script but i'm trying to figure out why i keep getting an error. #!/usr/bin/perl -w use strict; use warnings; my $baseDir = '/export/home/omcadmin/bin'; my $attachment = "$baseDir/message.txt"; my $from = 'xxx@xxx.com'; my $to = 'xxx@xxx.com'; my $cc = 'xxx@xxx.com'; my $subj = 'Testing'; my $body = 'TEST'; my $cmd = "uuencode $attachment |mailx, '-s',$subj, '-c', $cc, $to, "-f$from""; system ("$cmd"); The error i receive is: email.pl: use: not found email.pl: use: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: my: not found email.pl: syntax error at line 19: `system' unexpected Any suggestions? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
My first guess is that it appears to not be finding perl, but is instead trying to run as a shell program... See if perl exists in the location that your script is checking: Code:
ls -ail /usr/bin/perl If it returns a message indicating perl: No such file or directory, you will need to find out where perl IS installed, and update your script with the proper path information: Code:
which perl or Code:
find / -name perl -print |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Seems your $cmd = ..... statement has wong double quote -
Try - my $cmd = "uuencode $attachment |mailx -s $subj -c $cc $to -f $from"; Why are you making single quote around the mail options ? I don't think it is require You can check where perl is installed at the first place and then provide the path to perl interpreter Check where perl installed and the version perl -V |
|
#4
|
|||
|
|||
|
Perl is installed in the directory in which im running my script
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
can you just paste the out put of your perl path from which perl command
You can check if the path to the module are in @INC path ? type in command promt : perl -e 'use strict;' if your path are ok this should work fine |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
What should happen when i execute the perl -e 'use strict;' on the command prompt. I didn't get anything on the prompt.
---------- Post updated at 11:24 AM ---------- Previous update was at 11:22 AM ---------- If i attempt to execute a different script it will work from the directory in which i'm running the current script that fails. This tells me that the path is correct. |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
identify a script that is working. Code:
head -1 scriptname Ensure that this line matches the line that starts your script. Last edited by avronius; 09-03-2009 at 11:36 AM.. Reason: Fixed grammar |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Email with Attachment | piyushprabhakar | AIX | 5 | 07-10-2008 06:10 AM |
| how to deattach attachment of email | kandati | UNIX for Dummies Questions & Answers | 4 | 03-04-2005 05:29 AM |
| script that will send and email attachment | davels | Shell Programming and Scripting | 2 | 01-01-2005 04:44 AM |
| Email Attachment | Cyro | UNIX for Dummies Questions & Answers | 2 | 11-10-2003 09:24 AM |
| Email Attachment | prasad01 | UNIX for Dummies Questions & Answers | 2 | 08-07-2003 02:43 PM |
|
|