shell script demo

 nguyenhuybo@VN-LV00184-N Downloads % cat call_api.sh 

#!/bin/bash



n=$1

echo $2


send_omikuji(){

    echo "starting new call api: omikuji"

    curl -X 'POST' 'https://talkfortune-notification-hook.line-apps-beta.com/callback' -H 'connection: close' -H 'user-agent: LineBotWebhook/2.0' -H 'content-length: 315' -H 'content-type: application/json; charset=utf-8' -H 'x-line-signature: plpngha8sEj7LJe6xd/6InfKBWQ32kso2SOaAQKL01o=' -H 'host: talkfortune-notification-hook.line-apps-beta.com' -d $'{"destination":"u367dfc1ff8ed00c67a5966f542e5c25e","events":[{"type":"message","message":{"type":"text","id":"379186645792718849","text":"おみくじ"},"timestamp":1638844157276,"source":{"type":"user","userId":"uf4167f77e339b332dd154eb8ead96191"},"replyToken":"ecc430ba04d047b8a5232922fcd4f760","mode":"active"}]}'

}


send_draw_fortune(){

    echo "starting new call api: draw_fortune"

    curl -X 'POST' 'https://talkfortune-notification-hook.line-apps-beta.com/callback' -H 'connection: close' -H 'user-agent: LineBotWebhook/2.0' -H 'content-length: 286' -H 'content-type: application/json; charset=utf-8' -H 'x-line-signature: 1cmIY5Uz06HJrrzyHiAtn9QvI/EReooFxPBFpfN04gc=' -H 'host: talkfortune-notification-hook.line-apps-beta.com' -d $'{"destination":"u367dfc1ff8ed00c67a5966f542e5c25e","events":[{"type":"postback","postback":{"data":"おみくじを引く"},"timestamp":1638844199223,"source":{"type":"user","userId":"uf4167f77e339b332dd154eb8ead96191"},"replyToken":"f66a95ff600349328f45c0fa1eb4a971","mode":"active"}]}'

}


i=1

while [ $i != $n ]

do

  echo "starting new call api: \n"


  if [[ $2 == "o" ]];

  then

    send_omikuji

  else

    send_draw_fortune

  fi


  ((i = i + 1))

  echo "i++: $i"

done%                                                                           nguyenhuybo@VN-LV00184-N Downloads % 

Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch