3 Replies Latest reply on Aug 15, 2012 8:46 AM by Bill Robinson

    Problem with hyphen in setPreCmd

    Bruce Wauer

      We are running BladeLogic 8.2.01.290. We are trying to set a deploy job pre-command using the blcli below in a NSH script:

       

      #!/bin/nsh

      blcli_execute Job findByDBKey $DEPLOY_JOB_DBKEY

      blcli_execute Utility storeTargetObject deployjob

      blcli_execute Utility setTargetObject

      if (agentinfo $TARGET_SERVER | grep Operating | grep -q Windows); then

           PRE_COMMAND="del /S/F/Q ??APP_PATH??/*"

      else

           PRE_COMMAND="rm –rf ??APP_PATH??/*"

      fi

      blcli_execute DeployJob setPreCmd "$PRE_COMMAND"

      blcli_execute Job update NAMED_OBJECT=deployjob

       

      This code runs with no errors, and the pre-command for Windows works fine. The problem is with the Unix "rm -rf" command. It shows up in the console like this:

       

      Img2.JPG

      It appears that the hyphen is causing problems - it gets converted to some weird set of characters, and the last two characters of the command are truncated. I have tried escaping it and putting the command in single quotes, and even tried replacing the hyphen with "\x2D", but no luck. When I remove the hyphen from the PRE_COMMAND parameter, all works fine. Any ideas on how I can get this to work?