[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to check that if a package is installed?



Hi,
On Tue, Nov 30, 2010 at 04:54:40AM -0800, S Mathias wrote:
> if [ "$(dpkg -l | awk '/tofrodos/ && /^ii/ {print $2}' | awk '/^tofrodos/')" == "" ]; then echo -e "error: no zip package detected\!\n\nYou could install it like e.g.: \"apt-get install tofrodos\""; fi
> 
> Is there a better way then this?
Yes, I think so:
(dpkg -l | grep -q "^ii  tofrodos ") || echo "not installed"

That should do the same....

Axel


Reply to: