Skip to content

The current function is not supported #174

@snail2sky

Description

@snail2sky

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"
}

report

After my debugging, I found that there are many syntaxes that do not support them.

  1. for loop
  2. Array
  3. Logical operation of single brackets []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions