fix shellcheck warning SC2207

This commit is contained in:
Ben Harris 2020-06-17 13:57:36 -04:00
parent 53e64bb1eb
commit 543dd48e01
1 changed files with 6 additions and 5 deletions

11
bot.sh
View File

@ -88,16 +88,17 @@ do
from=$(printf "%s" "$line" | sed -E "s/.*PRIVMSG (.*[#]?([a-zA-Z]|\-)*) :.*/\1/")
# "#" would mean it's a channel
if [[ $from =~ ^#.* ]]; then
test "$(printf %s "$line" | grep ":$nick:")" || continue
args=$(printf %s "$line" | sed -E "s/.*:$nick:(.*)/\1/")
if printf %s "$from" | grep -q "^#"; then
# channel messages need to continue our nick
printf %s "$line" | grep -q ":$nick:" || continue
trailing=$(printf %s "$line" | sed -E "s/.*:$nick:(.*)/\1/")
else
args=$(printf %s "$line" | sed -E "s/.*$nick :(.*)/\1/")
trailing=$(printf %s "$line" | sed -E "s/.*$nick :(.*)/\1/")
from="$who"
fi
# trim leading and split args on space
args=( $(printf %s "$args" | sed -E "s/^ //") )
IFS=" " read -r -a args <<< "$(printf %s "$trailing" | sed -E "s/^ //")"
case "${args[0]}" in
subscribe)