Loading ...
Sorry, an error occurred while loading the content.
 

Quoting problem

Expand Messages
  • Dukelow, Don
    I know I should know this, but I ve always had quoting problems. I m doing a Perl ssh using UNIX kstat command. ($stdout, $stderr, $exit) = $ssh- cmd( $kstat
    Message 1 of 6 , Jan 27, 2009
      I know I should know this, but I've always had quoting problems. I'm doing a Perl ssh using UNIX kstat command.
      ($stdout, $stderr, $exit) = $ssh->cmd("$kstat -p $driver:$instance::'/^link_/'")

      I get the error
      Use of uninitialized value $instance:: in concatenation

      How do I quote this to separate the "::" from the $instance scalar.

      -----
      Don Dukelow
      HP/GM GSC33 License Team
      e-mail: dukelow@...
    • Jeff Pinyan
      ... The simplest method is to put braces around the variable name: $kstat -p $driver:${instance}:: /^link_/ But you could also do: $kstat -p
      Message 2 of 6 , Jan 27, 2009
        On Tue, Jan 27, 2009 at 10:26 AM, Dukelow, Don <dukelow@...> wrote:

        > I know I should know this, but I've always had quoting problems. I'm doing
        > a Perl ssh using UNIX kstat command.
        > ($stdout, $stderr, $exit) = $ssh->cmd("$kstat -p
        > $driver:$instance::'/^link_/'")
        >
        > How do I quote this to separate the "::" from the $instance scalar.


        The simplest method is to put braces around the variable name:

        "$kstat -p $driver:${instance}::'/^link_/"

        But you could also do:

        "$kstat -p $driver:$instance" . "::'/^link_/"

        "$kstat -p $driver:$instance\::'/^link_/"

        --
        The Cross Reference - http://thecrossreference.blogspot.com/
        Critical Mass (The Science of the Liturgy) -
        http://romanliturgy.blogspot.com/

        [Mary said,] "Do whatever he tells you." ~ John 2:5


        [Non-text portions of this message have been removed]
      • Dukelow, Don
        Sorry but I tried all three ways and get nothing in stdout. The stderr get a usage messag frp kstat. ... Don Dukelow HP/GM GSC33 License Team Tel:
        Message 3 of 6 , Jan 27, 2009
          Sorry but I tried all three ways and get nothing in stdout. The stderr get a usage messag frp kstat.


          -----
          Don Dukelow
          HP/GM GSC33 License Team
          Tel: 810-728-3388
          e-mail: dukelow@...



          ________________________________
          From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Jeff Pinyan
          Sent: Tuesday, January 27, 2009 10:57 AM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] Quoting problem


          On Tue, Jan 27, 2009 at 10:26 AM, Dukelow, Don <dukelow@...<mailto:dukelow%40hp.com>> wrote:

          > I know I should know this, but I've always had quoting problems. I'm doing
          > a Perl ssh using UNIX kstat command.
          > ($stdout, $stderr, $exit) = $ssh->cmd("$kstat -p
          > $driver:$instance::'/^link_/'")
          >
          > How do I quote this to separate the "::" from the $instance scalar.

          The simplest method is to put braces around the variable name:

          "$kstat -p $driver:${instance}::'/^link_/"

          But you could also do:

          "$kstat -p $driver:$instance" . "::'/^link_/"

          "$kstat -p $driver:$instance\::'/^link_/"

          --
          The Cross Reference - http://thecrossreference.blogspot.com/
          Critical Mass (The Science of the Liturgy) -
          http://romanliturgy.blogspot.com/

          [Mary said,] "Do whatever he tells you." ~ John 2:5

          [Non-text portions of this message have been removed]





          [Non-text portions of this message have been removed]
        • Jenda Krynicky
          !post-top not do Please From: Dukelow, Don ... And print $kstat -p $driver:${instance}:: /^link_/ ; print s what? Does that look how you
          Message 4 of 6 , Jan 27, 2009
            !post-top not do Please

            From: "Dukelow, Don" <dukelow@...>
            > Sorry but I tried all three ways and get nothing in stdout. The stderr get a usage messag frp kstat.
            >
            > -----
            > Don Dukelow
            >
            > ________________________________
            > From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Jeff Pinyan
            > Sent: Tuesday, January 27, 2009 10:57 AM
            > To: perl-beginner@yahoogroups.com
            > Subject: Re: [PBML] Quoting problem
            >
            > On Tue, Jan 27, 2009 at 10:26 AM, Dukelow, Don <dukelow@...<mailto:dukelow%40hp.com>> wrote:
            >
            > > I know I should know this, but I've always had quoting problems. I'm doing
            > > a Perl ssh using UNIX kstat command.
            > > ($stdout, $stderr, $exit) = $ssh->cmd("$kstat -p
            > > $driver:$instance::'/^link_/'")
            > >
            > > How do I quote this to separate the "::" from the $instance scalar.
            >
            > The simplest method is to put braces around the variable name:
            >
            > "$kstat -p $driver:${instance}::'/^link_/"
            >
            > But you could also do:
            >
            > "$kstat -p $driver:$instance" . "::'/^link_/"
            >
            > "$kstat -p $driver:$instance\::'/^link_/"

            And

            print "$kstat -p $driver:${instance}::'/^link_/";

            print's what? Does that look how you expected? Do the variables
            contain what you expected? Any newlines for example?

            Jenda
            ===== Jenda@... === http://Jenda.Krynicky.cz =====
            When it comes to wine, women and song, wizards are allowed
            to get drunk and croon as much as they like.
            -- Terry Pratchett in Sourcery
          • Jeff Pinyan
            ... I take it that was STDERR gets a usage message from kstat ? I would guess your variables don t hold what you think they hold. Try printing them out for
            Message 5 of 6 , Jan 27, 2009
              On Tue, Jan 27, 2009 at 11:43 AM, Dukelow, Don <dukelow@...> wrote:

              > Sorry but I tried all three ways and get nothing in stdout. The stderr get
              > a usage messag frp kstat.
              >

              I take it that was "STDERR gets a usage message from kstat"?

              I would guess your variables don't hold what you think they hold. Try
              printing them out for debugging purposes.

              print "kstat = [$kstat]\n";
              print "driver = [$driver]\n";
              print "instance = [$instance]\n";

              Perhaps you'll be surprised.

              --
              The Cross Reference - http://thecrossreference.blogspot.com/
              Critical Mass (The Science of the Liturgy) -
              http://romanliturgy.blogspot.com/

              [Mary said,] "Do whatever he tells you." ~ John 2:5


              [Non-text portions of this message have been removed]
            • Dukelow, Don
              You were right my $kstat had kstat -i in it which I forgot about. I replaced it with -p and all is well. Thanl You! ... Don Dukelow HP/GM GSC33 License
              Message 6 of 6 , Jan 28, 2009
                You were right my $kstat had "kstat -i" in it which I forgot about. I replaced it with "-p" and all is well.
                Thanl You!


                -----
                Don Dukelow
                HP/GM GSC33 License Team
                e-mail: dukelow@...



                ________________________________
                From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Jeff Pinyan
                Sent: Tuesday, January 27, 2009 3:02 PM
                To: perl-beginner@yahoogroups.com
                Subject: Re: [PBML] Quoting problem


                On Tue, Jan 27, 2009 at 11:43 AM, Dukelow, Don <dukelow@...<mailto:dukelow%40hp.com>> wrote:

                > Sorry but I tried all three ways and get nothing in stdout. The stderr get
                > a usage messag frp kstat.
                >

                I take it that was "STDERR gets a usage message from kstat"?

                I would guess your variables don't hold what you think they hold. Try
                printing them out for debugging purposes.

                print "kstat = [$kstat]\n";
                print "driver = [$driver]\n";
                print "instance = [$instance]\n";

                Perhaps you'll be surprised.

                --
                The Cross Reference - http://thecrossreference.blogspot.com/
                Critical Mass (The Science of the Liturgy) -
                http://romanliturgy.blogspot.com/

                [Mary said,] "Do whatever he tells you." ~ John 2:5

                [Non-text portions of this message have been removed]





                [Non-text portions of this message have been removed]
              Your message has been successfully submitted and would be delivered to recipients shortly.