From afa60c4f9de22f4176d38d4b042a3551e2027ba9 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 3 Feb 2020 05:00:47 +0100 Subject: [PATCH] Keep track of the child ii(1) process --- src/deforaos-irc.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/deforaos-irc.sh b/src/deforaos-irc.sh index caefa78..5a8c698 100755 --- a/src/deforaos-irc.sh +++ b/src/deforaos-irc.sh @@ -45,7 +45,7 @@ _irc() return 1 fi ret=0 - pid= + pid=0 server=$(echo "$1" | $TR A-Z a-z) port="$2" nickname="$3" @@ -56,9 +56,8 @@ _irc() #connect to the server if [ ! -w "$serverin" ]; then _info "$server: Connecting to server" - #FIXME really keep track of pid $II -s "$server" -p "$port" -n "$nickname" & - pid=0 + pid=$! fi #wait until the server is connected to loop=0 @@ -119,7 +118,7 @@ _irc() _error "$channel: Could not join channel" fi fi - if [ -n "$pid" ]; then + if [ $pid -gt 0 ]; then #quit the server _info "$server: Disconnecting from server" fortune=$($FORTUNE | $HEAD -n 1 | $CUT -c 1-50)