Convert arguments to array

This commit is contained in:
Michael De Roover 2021-02-07 15:09:36 +01:00
parent 16897ba7ec
commit aaff6f0b60
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -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(){