From aaff6f0b601e9e0e9d1c8c1ce4b05f70e4f3437c Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Sun, 7 Feb 2021 15:09:36 +0100 Subject: [PATCH] Convert arguments to array --- konata.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/konata.sh b/konata.sh index 01b7a8b..9521d12 100755 --- a/konata.sh +++ b/konata.sh @@ -83,7 +83,7 @@ alive(){ } cv(){ - stats=$(curl -s "https://corona.lmao.ninja/v2/countries/$args") + stats=$(curl -s "https://corona.lmao.ninja/v2/countries/${args[*]}") country=$(jq -r '.country' <<< $stats) cases=$(jq -r '.todayCases' <<< $stats) pm=$(jq -r '.testsPerOneMillion' <<< $stats) @@ -101,18 +101,18 @@ id(){ } ud(){ - enc=$(echo "$args" | sed "s/\ /%20/g") + enc=$(echo "${args[*]}" | sed "s/\ /%20/g") res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc") if jq -re '.list[0].definition' <<< $res then def=$(jq -r '.list[0].definition' <<< $res | sed "s/[][]//g") sam=$(jq -r '.list[0].example' <<< $res | sed "s/[][]//g") - sendmsg "*Definition for __${args}__:* + sendmsg "*Definition for __${args[*]}__:* $(escape "()" "$def") *Example:* $(escape "()" "$sam")" else - sendmsg "No definition found for $args." + sendmsg "No definition found for ${args[*]}." fi } @@ -138,7 +138,7 @@ mp3(){ tmp="/tmp/mp3" [ ! -d $tmp ] && mkdir $tmp sendmsg "Downloading, this might take a while..." - youtube-dl -f 140 --max-filesize 50M -o "$tmp/%(title)s.%(ext)s" "$args" + youtube-dl -f 140 --max-filesize 50M -o "$tmp/%(title)s.%(ext)s" "${args[*]}" rm $tmp/*.part if [ -f $tmp/* ] then @@ -161,8 +161,8 @@ stat(){ term(){ admin - sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`$args\` - \`$(echo $args | bash - 2>&1)\`" + sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`${args[*]}\` + \`$(echo ${args[*]} | bash - 2>&1)\`" } 4c(){