3 Replies Latest reply on May 16, 2019 7:01 PM by Bill Robinson

    Strange read-stdout behaviour when using blclis in functions

    Markus Kruse
      Share This:

      Hello Guys,


      I'm facing the following situation with reading stdout of an function.


      function getOwnJobExecutionInformationByDBKey ()


      local JOB_KEY=$1

      local VAR1=$2

      local VAR2=$3


      #blcli_execute Job getJobNameByDBKey "${JOB_KEY}"

      #blcli_storeenv JOB_NAME


      echo "$JOB_KEY" "$VAR1" "$VAR2"



      JOBKEY=$( echo -n $0 | sed 's/^.*DBKey/DBKey/' | cut -d"_" -f1 | sed 's/-/:/;s/-/:/')

      read "KEY" "TESTVAR1" "TESTVAR2" < <(getOwnJobExecutionInformationByDBKey "${JOBKEY}" "Hello" "World" )

      echo "${KEY} in ${TESTVAR1} in ${TESTVAR2}"


      this works and the echo gives me "$KEY in Hello in World"


      but once I use the blcli command (doesn't matter if I change echo ouput, normally I want to output the JOB_NAME not the KEY)


      blcli_execute Job getJobNameByDBKey "${JOB_KEY}"

      blcli_storeenv JOB_NAME


      it gives me: " in in "


      Why is that? It passes the Variable "JOBKEY" to the function perfectly (i checked that with some echos) and it's executing the blcli-command aswell.