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 We are trying to set a deploy job pre-command using the blcli below in a NSH script:



      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??/*"


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


      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:



      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?