Professional Web Applications Themes

How to take command line argument and use it to run an upgrade script. - PERL Beginners

I'm a perl newby. I'm looking on taking a command line argument from STDIN and use it for input to a script that upgrades software. Any examples would be greatly appreciated. Thanks ===== Jeffrey T. Collins [email]jtbaca[/email] __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! [url]http://webhosting./ps/sb/[/url]...

  1. #1

    Default How to take command line argument and use it to run an upgrade script.

    I'm a perl newby.
    I'm looking on taking a command line argument from
    STDIN and use it for input to a script that upgrades
    software. Any examples would be greatly appreciated.

    Thanks

    =====
    Jeffrey T. Collins
    [email]jtbaca[/email]

    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free web site building tool. Try it!
    [url]http://webhosting./ps/sb/[/url]
    Jeff Collins Guest

  2. #2

    Default Re: How to take command line argument and use it to run an upgrade script.

    On Thu, 2004-01-22 at 18:14, Jeff Collins wrote:
    > I'm a perl newby.
    > I'm looking on taking a command line argument from
    > STDIN and use it for input to a script that upgrades
    > software. Any examples would be greatly appreciated.
    STDIN is already open when your perl script starts so you can read in
    from it by using:

    my $variable = <STDIN>

    And there are interfaces to curses, tk, and gtk if you feel like
    creating a nice user interface.

    Dan

    Dan Anderson Guest

  3. #3

    Default Re: How to take command line argument and use it to run an upgrade script.

    > I'm a perl newby.
    me too:-) Right list, I assume.
    > I'm looking on taking a command line argument from
    > STDIN and use it for input to a script that upgrades
    > software. Any examples would be greatly appreciated.
    ARGV holds your command line arguments.

    call:
    scriptname.pl Universe 42 douglas 'Zappod Beblebrox'

    #! /usr/bin/perl
    use strict;
    use warnings;
    print "You called me with ", scalar ARGV, " Arguments.\n";
    if (ARGV) {
    print " Param to script: $_\n" foreach (ARGV);
    }

    Notice that there is a nice wa of processing command line args with the
    getopt:: modules from CPAN.

    Also take a look at perldoc perlvar for detailed info about ARGV, ARGV and
    $ARGV.

    Hope that helps, Wolf

    Wolf Blaum Guest

  4. #4

    Default Re: How to take command line argument and use it to run an upgrade script.


    On Jan 22, 2004, at 3:39 PM, wolf blaum wrote:
    [..]
    >
    > call:
    > scriptname.pl Universe 42 douglas 'Zappod Beblebrox'
    >
    > #! /usr/bin/perl
    > use strict;
    > use warnings;
    > print "You called me with ", scalar ARGV, " Arguments.\n";
    > if (ARGV) {
    > print " Param to script: $_\n" foreach (ARGV);
    > }

    My Compliments on a well done piece.

    One of the stock modules most of us use is Getopt::Long
    which is really good for the more complex command line optioning.
    cf:
    perldoc Getopt::Long

    An Illustration:
    <[url]http://www.wetware.com/drieux/pbl/perlTrick/CommandLine/[/url]
    do_get_opt_long.txt>




    ciao
    drieux

    ---

    Drieux Guest

  5. #5

    Default Re: How to take command line argument and use it to run an upgrade script.


    > My Compliments on a well done piece.
    OT:
    see, a logical problem I have with newsgroups is that you learn most (at least
    I do) by trying to explain things you think you understood to others -
    "beginning explainers" however make mistakes -
    Thats of course not what you want in a newsgroup, since there is the one
    asking, who is learning too, whom you dont want to confuse with "slightly
    right" answers.

    Nevertheless Im happy it seems this is a group were you can even learn how to
    explain (and what the group-iquette is anyway).

    Thanks for that,
    Wolf

    Wolf Blaum Guest

  6. #6

    Default The Challenge of Learning to Explain - Re: How to take command line argument and use it to run an upgrade script.


    On Jan 22, 2004, at 5:56 PM, wolf blaum wrote:
    [..]
    > Nevertheless Im happy it seems this is a group were
    > you can even learn how to explain (and what the group-iquette is
    > anyway).
    [..]

    Good point there.

    A part of the struggle is always sort out what
    the OP is really working with, and where are they
    really trying to go with their idea. The only way
    that a person can sort that out is by trial and error.


    ciao
    drieux

    ---

    Drieux Guest

Similar Threads

  1. My Script to run a Command-Line from ASP does not work.
    By Lucas Cowald in forum ASP.NET Building Controls
    Replies: 10
    Last Post: October 23rd, 08:01 PM
  2. My Script to run a Command-Line from ASP does not work
    By Lucas Cowald in forum ASP.NET Web Services
    Replies: 0
    Last Post: October 23rd, 06:46 AM
  3. [PHP] execute command line script from browser
    By Jay Blanchard in forum PHP Development
    Replies: 0
    Last Post: September 2nd, 12:40 PM
  4. How to use Command line argument --help or --debug ???
    By magnum_mentor in forum PERL Beginners
    Replies: 0
    Last Post: August 23rd, 01:17 PM
  5. using a directory name as a command line argument
    By Brian Harnish in forum PERL Miscellaneous
    Replies: 1
    Last Post: August 12th, 03:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139