Artificial intelligent assistant

Check if wireless-tools is installed or not in bash script i want to check if `wireless-config` (for `iwconfig`) is installed on the system (debian). If not, then install this with `apt-get`. My bash script looks like this: if ! hash wireless-tools 2>/dev/null; then apt-get install wireless-tools; else echo "wireless-tools is installed" fi The big problem: `hash wireless-tools` seems not to work. There is never anything to return, either if wireless-tools is installed or not. How can i check for this in a different way?

I would suggest `type` over `hash` for checking the binary. However, there is also a tool specifically designed for checking the state of packages:


if ! dpkg-query -s wireless-tools 1> /dev/null 2>&1 ; then
echo "Package wireless-tools is not currently installed."
else
echo "Package wireless-tools is currently installed."
fi

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 229e1f55ceb0b6c687fce37d4e2d9218