in reply to System Command Issues
The '<' is something that the shell interprets, but in the multi-arg form of system the shell is bypassed altogether, and '<' is being passed as another argument to mail. Try this instead:
my $address = 'myname@whatever.com'; my $subject = "Comments -- Version: $Version ID: $ID"; system("mail $address -s '$subject' < blah6.txt") == 0 or die "mail failed: $?";
Update: As ikegami's reply below alludes to, a major reason for using the multi-arg form of system is precisely to bypass the shell, and therefore avoid shell quoting headaches. The single argument form of system may not be suitable if $Version or $ID contain problematic characters. If this is the case, I would break down and read in the contents of the input file, and pipe it into the mail command from within the Perl code.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: System Command Issues
by ikegami (Patriarch) on Jun 08, 2005 at 20:46 UTC | |
|
Re^2: System Command Issues
by blanket (Initiate) on Jun 08, 2005 at 20:55 UTC | |
by tlm (Prior) on Jun 08, 2005 at 21:09 UTC | |
by blanket (Initiate) on Jun 09, 2005 at 14:02 UTC | |
by tlm (Prior) on Jun 09, 2005 at 14:27 UTC | |
by blanket (Initiate) on Jun 09, 2005 at 14:59 UTC | |
|