LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How to find out if you have a specific package installed? (http://www.linuxquestions.org/questions/slackware-14/how-to-find-out-if-you-have-a-specific-package-installed-567667/)

AriciU 07-08-2007 06:26 PM

How to find out if you have a specific package installed?
 
What is the command? For example......... check if you have python.

$ whereis python

?

erklaerbaer 07-08-2007 06:28 PM

which python if you are looking for the binary
ls /var/log/packages/ if you are looking for the package

kite 07-08-2007 11:58 PM

bash-3.1$ ls /var/log/packages/ |grep python
python-2.5.1-i486-1
bash-3.1$

I put the following lines into $HOME/.bashrc, so every time I only need to do "spkg xxx" (partial name is working too) to see whether a package is installed or not (note: I am a newbie to shell scripting):

Code:

##### A simple package search script #####
##### for installed slackware packages ######
spkg() {
read keyword
echo "+==========================+"
echo "|Here is the search result:|"
echo "+==========================+"
ls /var/log/packages |grep $1
if [ $? -eq 1 ]
then
echo "The package(s) NOT FOUND"
fi
}



All times are GMT -5. The time now is 05:01 PM.