New review comment by ahesford on void-packages repository https://github.com/void-linux/void-packages/pull/37139#discussion_r903678411 Comment: - Test the `added` before splitting lines, and use shell suffix matching to extract the status instead of `grep` - Use a `case` statement instead of a pair of `test` invocations to match built and installed modules - `printf %s "some string"` -> `printf "some string"`; the format insertion is unnecessary here ```suggestion $DKMS status -m "$1" | while read -r line; do if [ "${line##*: }" = "added" ]; then # The module wasn't built successfully for any kernel version; remove it printf "Cleaning up DKMS module '$modname-$modver'... " $DKMS remove -m "$modname" -v "$modver" >/dev/null 2>&1 continue fi IFS=,:/ read -r modname modver kver arch status _ <<-EOF $line EOF case "$status" in installed|built) # The module was installed or built for a kernel version; remove it printf "Removing DKMS module '$modname-$modver' for kernel-$kver... " $DKMS remove -m "$modname" -v "$modver" -k "$kver" >/dev/null 2>&1 ;; *) # Any other status is unexpected; just ignore ;; esac ```