I need to build a command concatenating other smaller string values:function processES {  local status=$KO_UNKNOWN  local method=GET  if [ ! -z $1 ]; then method=$1; fi  local curl=curl -s -X${method} $2  if [ ! -z $3 ]; then curl+= -d '$3'; fi  local jq=jq 'if has(\error\) then .error.type elif has(\acknowledged\) then \ok\ else \unknown\ end'  local sed=sed -e 's/^\//'  -e 's/\$//'  local command=$curl | $jq | $sed  <<<<<<<<<<<< CONCATENATION  echo $command  local r=$(command)  e_warning $r  if [ $? == $RESPONSE_OK ]; then    status=$OK  elif [ $? == $RESPONSE_ERROR_IDXALDEXISTS ]; then    status=$KO_IDXALDEXISTS  else    status=$KO_UNKNOWN  fi  return $status}The concatenated command is well built:curl -s -XPUT http://localhost:9201/living_v1 | jq 'if has(error) then .error.type elif has(acknowledged) then ok else unknown end' | sed -e 's/^//' -e 's/$//'The problem is I'm not quite to see how to perform it and get the result and set it on a variable.Any ideas?
howto perform a concatenaned command and set result on variable
shell script