This seems like it would be simpler to say status_of_proc -p $PIDFILE $DAEMON $NAME; status="$?"