“本地:不在函数中”

时间:2019-03-20 15:58:30

标签: linux bash command sh

我们想将信息发送到Mattermost中的频道,但是我在脚本中遇到此错误。

#!/bin/bash 
#start
matterSend() {
  # Lowercase variable names; declare them local
  local endpoint=https://mattermost.ltd/hooks/hash..
  local username=$USER
  # Pro tip: don't use a variable for the payload if it's effectively static
  payload=$(cat <<-__EOF
    payload={
    "username" : "$username",
    "channel" : "Genel_Log",
    "text" : "#### ---\\n| Yedekeleme     | Drive Gönderim       | İşlem ***                               |\\n|:-----------|:-----------:|-----------------------------------------------:|\\n| ${2}       | ${3}        | ${1} :white_check_mark:            |\\n"
    }
__EOF
  )

  echo "CURL: curl -i -X POST -d $payload $endpoint"
  curl -i -X POST -d "$payload" "$endpoint"
}
STRING="Starting.." 
matterSend

结果:

  

fileName.sh:5:本地:不在函数中

原因是什么?

0 个答案:

没有答案