in reply to Re^2: Add Perl Varibles in system()
in thread Add Perl Varibles in system()

Thank you for your quick response. And the reason why  $target was written the way it was is because it was orginally going to be mutiple varibles, and I forgot to remove the paraentheses when I took ou the other varible. But now I have a different problem I want to the success of the program. This is what I believe will work:
system( 'nmap', $ver, $os, $target ' -oG pentest.txt')=0 || print "Nma +p failed! $!"; exit1;
But there is probably a better way to write that. Any suggestions?

Replies are listed 'Best First'.
Re^4: Add Perl Varibles in system()
by ikegami (Patriarch) on May 12, 2009 at 21:37 UTC

    Bugs:

    • Missing comma
    • "-oG" and "pentest.txt" are separate args. You can't pass them as one.
    • The dash should be the start of the arg, not a space.

    You also introduced four bugs in the error handling!

    Fixed:

    system( 'nmap', $ver, $os, $target, '-oG', 'pentest.txt' ) or die "nmap failed" $!/$?\n";