On Wed, Jul 21, 2010 at 1:17 PM, newbie01 perl <[email protected]> wrote:
> Does $_ contains the following values on each iteration?
>
> mail_smtp.pl
> -r
> ${MAILFROM}
> -s
> "$subject_line TEST EMAIL"
> [email protected]
> <
> /tmp/test_email.txt
Just to clarify the end of the command line:
mail_smtp.pl -r ${MAILFROM} \
-s "$subject_line TEST EMAIL" \
[email protected] < /tmp/test_email.txt
The '< /tmp/test_email.txt' part is not extra arguments passed to the
script. That is a file redirection operator in the shell[1], used to
write the file to the script's standard input stream. The script
accepts an option -f to specify the file to retrieve the message data
from, but if none is specified then it defaults to - which is
basically an alias for STDIN.[2]
The same thing can be accomplished with a pipe:
cat /tmp/test_email.txt | mail_smtp.pl -r ${MAILFROM} \
-s "$subject_line TEST EMAIL" [email protected]
So the script wouldn't see arguments equal to '<' or
'/tmp/test_email.txt'. The shell will handle those for it automatically.
[1] http://en.wikipedia.org/wiki/Redirection_(computing)
[2] perldoc -f open
--
Brandon McCaig <[email protected]>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <[email protected]>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/