Any reason you have to use that very awkward ksh script to retrieve 2 text fields from a file? While at first look it should run as you expect it, that construct could be avoided, and by doing it from perl you wouldn't have to rely on result from a backtick operation, that could cause various unforeseen issues due to ENV values and many other problems.
I'm thinking here something along the lines of:
open(DBFILE,"~/.passwd");
while($line = <DBFILE>)
{
if ($line =~ /$dbname(\w+)(\w+)/) {
$dbUser = $1;
$dbPass = $2;
}
}
If you must have an outside script because it is used from other processes also, you could tidy that one up too with awk for example. The whole writing a temp file to extract a text field is very un-unix way of doing it.
awk '/^abc01/{ print $2 " " $3; }' ~/.passwd
would give you the same fields as the getDBlogin script. The strange part about your log is that the log won't even show what came back from your backtick operation, at least you should see
tempStr:
by itself.
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.