-
-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
This is a shell script in my orangepi for reporting native IP, but it cannot compile it
#!/bin/bash
time=`date "+%F_%T"`
ips=`hostname -I`
webhook_url='https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxx??????'
json='{"msg_type":"text","content":{"text":"%s"}}'
report(){
let i=1
local head="Currente time:`date '+%F %T'`\n`uptime | cut -d' ' -f3-`"
for ip in $ips; do
if [ -z "$newip" ]; then
local newip="$i: $ip"
else
local newip="${newip}\n$i: ${ip}"
fi
let i++
done
local json=`printf "$json" "$head\n$newip"`
curl -X POST -H "Content-Type: application/json" -d "$json" "$webhook_url"
}
reportAfter my debugging, I found that there are many syntaxes that do not support them.
- for loop
- Array
- Logical operation of single brackets []
Metadata
Metadata
Assignees
Labels
No labels