in reply to backtick operator
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:
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.open(DBFILE,"~/.passwd"); while($line = <DBFILE>) { if ($line =~ /$dbname(\w+)(\w+)/) { $dbUser = $1; $dbPass = $2; } }
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 seeawk '/^abc01/{ print $2 " " $3; }' ~/.passwd
by itself.tempStr:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: backtick operator
by Anonymous Monk on May 13, 2010 at 21:32 UTC | |
by AndyZaft (Hermit) on May 13, 2010 at 22:03 UTC | |
by Anonymous Monk on May 14, 2010 at 03:11 UTC | |
by Anonymous Monk on May 14, 2010 at 06:41 UTC | |
by Hue-Bond (Priest) on May 14, 2010 at 06:54 UTC | |
|
In Section
Seekers of Perl Wisdom