12 Replies Latest reply on Aug 18, 2015 8:57 AM by Yanick Girouard

    NSH Script Parameter: Passing NULL Value results to buffer "\000"

      Hello All,

       

      We are running with:

      BSA 8.5 SP1 Patch4

       

      We have a NSH Script of Type 1 With input parameters:

      1) TARGETS - $1

      2) File : $2 - List of Targets Provided

       

      The agenda is if we provide file as input then it reads the file and execute the job against the listed targets, and if the file is not present i.e. Null then it should execute the job against the target provided for the run.

       

      However the issue is when we pass the file parameter as null I can see the value getting assigned to $2 is "\000"

      so below condition fails:

       

      if [[ "$2" != "" ]]

      then

            echo "Using list of servers from file to define."

            TARGETS=`cat $2 | tr '\n' ' ' | tr -s '[:space:]' ' '`

      else

            echo "Using targets as servers in BladeLogic to define."

            TARGETS=$1

      Fi


      As a Workaround I have set it up a hardcoded value and for now this works for me.


      if [[ "$2" != "\000" ]]

      then

            echo "Using list of servers from file to undefine."

            TARGETS=`cat $2 | tr '\n' ' ' | tr -s '[:space:]' ' '`

      else

            echo "Using targets as servers in BladeLogic to undefine."

            TARGETS=$1

      Fi

      I do tried to put the default value in parameter as:

      "", NULL, null, %null% and Numeric (0). however no luck.


       

      Thanks

      Pravin