This line
|
# verify we have no "ruby" packages installed |
|
! dpkg -l | grep -i ruby; \ |
won't work as expected. Because of the ! it will always succeed.
Shellcheck tracks this behavior with
! dpkg -l | grep -i ruby
^-- SC2251: This ! is not on a condition and skips errexit. Use `&& exit 1` instead, or make sure $? is checked.
I can't see a clean one-liner to solve this, I think the correct way is to rather run:
if dpkg -l | grep -i 'ruby'; then return 1; fi
also dpkg -l can list previously uninstalled packages, to verify a package is actually installed it would rather be | grep -iP '^ii.*ruby.*'