Be careful of passing parameters with no checks. For example, a simple way might be:
my $status = system ("fred.bash @ARGV");
then someone calls it like this:
$ myscript.pl 'Program Files'
and two arguments get passed. You also have a problem if the arguments contain shell meta-characters like quotes, $, or ! in the data, which must be 'escaped' before passing. So you end up having to do something like this before calling
system:
for (@ARGV) {$_ = "\Q$_\E"}
My point is that you should not blindly throw data from Perl to the shell. Likewise when using arguments in shell scripts always enclose them in double quotes, including:
".\$1", although even that is not bullet proof.
You might also consider just using one language to solve your problem (Perl or Bash) rather than two. I know, sometimes we do that just to get a job done, but it is not a good long term design.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.