www.webdeveloper.com
Results 1 to 3 of 3

Thread: New to Perl, Help me quote this propperly. It just isn't working no matter what I do.

  1. #1
    Join Date
    Jan 2006
    Location
    Gloucester, MA
    Posts
    148

    New to Perl, Help me quote this propperly. It just isn't working no matter what I do.

    Code:
    $cmd = "grep \'sysObjectID.0\s+:{1}\s+CISCO-PRODUCTS-MIB!\' /database/configs/$kind/$device/system";
    ($stdout,$stderr) = $ssh->cmd("$cmd");
    Robert D. Cluett
    Systems Engineer & Web Developer
    Verizon Communications

  2. #2
    Join Date
    Mar 2011
    Posts
    1,141
    I only dabbled in Perl enough to do very simple tasks and my knowledge of grep is nearly zero, but I would start by removing the single quotes around the first parameter. Even if they're needed, you shouldn't have to escape them - as in:
    Code:
    $cmd = "grep sysObjectID.0\s+:{1}\s+CISCO-PRODUCTS-MIB! /database/configs/$kind/$device/system";
    ($stdout,$stderr) = $ssh->cmd("$cmd");
    Should "sysObjectID.0" be "$sysObjectID.0"? I'm not sure if the '\s' is a command switch or a part of a regular expression, so I'm over my head with the rest of the command. I think you'd be better off asking this in a Unix/Linux forum. Good luck!
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Oct 2007
    Location
    Vienna, Austria
    Posts
    392
    I'm too lazy to try and decipher what it should do. Please, tell me what you expect the $cmd variable to contain, exactly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles