#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0

    PERL Command Line Help


    Hi

    I am new to PERL and I have to migrate PERL code to JAVA.. When I am going through the code I got the Following command line argument

    "bwstat.pl --delay 5 --count 720 > ./logs/bwstat.log &
    /usr/sbin/ntpdate -bus date.goole.yahoo.com"

    and this file contains code like this

    use Time::HiRes;

    # default settings
    $version = "20120203";
    $device = "eth0";
    $delay = 5;
    $count = 1;


    GetOptions (
    "delay=i" => \$delay,
    "count=i" => \$count,
    "dev=s" => \$device,
    "header" => \$header,
    "version" => \$needVersion,
    "h|help" => \$needHelp);

    can u please explain what is mean by "> ./logs/bwstat.log &
    /usr/sbin/ntpdate -bus date.goole.yahoo.com" in command line

    Thanks in advance..
  2. #2
  3. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,257
    Rep Power
    1810
    Those are just unix directives about how to run a process. They aren't part of perl.

    This first one:

    bwstat.pl --delay 5 --count 720 > ./logs/bwstat.log &
    Says to run the perl script 'bwstat.pl' with the provided arguments, and to redirect STDOUT to the bwstat.log file.

    redirection

    It may have made more sense to hardcode output within the bwstat.pl file to write to a specific log file, but redirection allows for flexibility. The user can change the output location at run time. They have to know to do that however, or they'll just get a screenful of printed output.

    The ampersand at the end of the line says to run it as a background process.

    run in background

    ---

    The second line is a unix utility to update the system time from a remote server:

    ntpdate
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0
    Thanks a lot for Explanation..

IMN logo majestic logo threadwatch logo seochat tools logo