发送:找不到命令 - CentOS 6.2
send: command not found - CentOS 6.2
我正在尝试执行下一个脚本 (run.sh):
#!/bin/sh
# Rooms and Floors example
CEP=localhost:8080
. ../common.sh
# Send an updateContext request with Room temp
function sendRoomTemp() #(url, floor, room, value)
{
payload='{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "''",
"attributes": [
{
"name": "temperature",
"type": "double",
"value": ''
},
{
"name": "floor",
"type": "string",
"value": "''"
}
]
}
],
"updateAction": "APPEND"
}'
send "v1/updateContext" "$payload"
}
echo "#1 First update CEP with RoomsAndFloors configuration"
CONFIG=`cat config.json`
updateConfig $CEP "$CONFIG"
echo ""
echo "#2 Then send T° of all the rooms to the CEP every 5 sec"
for temp in 12 14 18 20 24 19; do
echo ""
echo "# Wait between temperatures updates..."
echo ""
sleep 5
for room in 1 2 3 4; do
for floor in 1 2 3; do
# compute a unique temp for each room
t=$(($temp + (2*$floor) + $room))
echo " - Send updateContext for Room$floor$room with T°=$t"
out=$(sendRoomTemp $CEP "Floor$floor" "Room$floor$room" "$t")
echo " $out"
done
done
done
当我执行 sh run.sh
时,我得到:
....
# Wait between temperatures updates...
- Send updateContext for Room11 with T°=15
run.sh: line 34: send: command not found
- Send updateContext for Room21 with T°=17
run.sh: line 34: send: command not found
....
脚本来自FIWARE Cepheus教程https://fiware-cepheus.readthedocs.org/en/latest/examples/1_RoomsAndFloors/index.html
我的机器是CentOS 6.2
我该如何解决?
谢谢!
您需要 运行 来自项目目录(如 doc/examples/1_RoomsAndFloors
)的示例 run.sh
脚本,因为它们取决于 common.sh
文件在定义 send
函数的父目录 doc/examples
。
我正在尝试执行下一个脚本 (run.sh):
#!/bin/sh
# Rooms and Floors example
CEP=localhost:8080
. ../common.sh
# Send an updateContext request with Room temp
function sendRoomTemp() #(url, floor, room, value)
{
payload='{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "''",
"attributes": [
{
"name": "temperature",
"type": "double",
"value": ''
},
{
"name": "floor",
"type": "string",
"value": "''"
}
]
}
],
"updateAction": "APPEND"
}'
send "v1/updateContext" "$payload"
}
echo "#1 First update CEP with RoomsAndFloors configuration"
CONFIG=`cat config.json`
updateConfig $CEP "$CONFIG"
echo ""
echo "#2 Then send T° of all the rooms to the CEP every 5 sec"
for temp in 12 14 18 20 24 19; do
echo ""
echo "# Wait between temperatures updates..."
echo ""
sleep 5
for room in 1 2 3 4; do
for floor in 1 2 3; do
# compute a unique temp for each room
t=$(($temp + (2*$floor) + $room))
echo " - Send updateContext for Room$floor$room with T°=$t"
out=$(sendRoomTemp $CEP "Floor$floor" "Room$floor$room" "$t")
echo " $out"
done
done
done
当我执行 sh run.sh
时,我得到:
....
# Wait between temperatures updates...
- Send updateContext for Room11 with T°=15
run.sh: line 34: send: command not found
- Send updateContext for Room21 with T°=17
run.sh: line 34: send: command not found
....
脚本来自FIWARE Cepheus教程https://fiware-cepheus.readthedocs.org/en/latest/examples/1_RoomsAndFloors/index.html
我的机器是CentOS 6.2
我该如何解决?
谢谢!
您需要 运行 来自项目目录(如 doc/examples/1_RoomsAndFloors
)的示例 run.sh
脚本,因为它们取决于 common.sh
文件在定义 send
函数的父目录 doc/examples
。