Score:0

bash syntax error near unexpected token

bf flag

I put a script to alert me when any new ssh connection via telegram at /etc/profile.d. But when I connect it says: syntax error near unexpected token what's the problem? my Code:

#!/usr/bin/env bash
# Import credentials form config file
. /home/roots/credentials.config
URL="https://api.telegram.org/bot${KEY}/sendMessage"
DATE="$(date "+%d %b %Y %H:%M")"
if [ -n "$SSH_CLIENT" ]; then
ip="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
coinfo=($(curl ipinfo.io/${ip}/country))
rinfo=($(curl ipinfo.io/${ip}/region))
cinfo=($(curl ipinfo.io/${ip}/city))"
tinfo=($(curl ipinfo.io/${ip}/timezone))
TEXT="New login via ssh. user name: ${USER}. IP: (*${ip}*)
date: ${DATE}
Approximate location: country ${coinfo}
Region: ${rinfo}
city: ${cinfo}
time zone: ${tinfo}
Note: Location data is approximate."
curl -s -d "chat_id=${USERID}&text=${TEXT}&disable_web_page_preview=true&parse_mode=markdown" $URL > /dev/null
fi
Score:0
tm flag

This doulbe quote is placed wrongly. Even the syntax highlighter here shows it:

cinfo=($(curl ipinfo.io/${ip}/city))"
#                                   ~
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.