dpkg -s seems to output some text, but exit status 1 for a non-installed package, and 0 for an installed package.
This bears testing in all three possible scenarios:
- Package has never been installed
- Package is currently installed
- Package was installed, then removed
The other option I've frequently seen used is
dpkg -l packagename |grep ^ii
but this has the potential same problem of piping dpkg output to grep.
It'd be great to somehow reproduce Jeffrey's error message so we know what causes it, and we can test that any proposed solution does *not* exhibit that behavior.
dpkg -s seems to output some text, but exit status 1 for a non-installed package, and 0 for an installed package.
This bears testing in all three possible scenarios:
- Package has never been installed
- Package is currently installed
- Package was installed, then removed
The other option I've frequently seen used is
dpkg -l packagename |grep ^ii
but this has the potential same problem of piping dpkg output to grep.
It'd be great to somehow reproduce Jeffrey's error message so we know what causes it, and we can test that any proposed solution does *not* exhibit that behavior.