Removing a package in unix

I have a package that i'm going to be adding...i wanted to make sure i knew how to remove it prior to instalation..

expect-5.40-sol8-sparc-local.gz

pkgadd -d ./expectpkg/

would the command to remove this package be...

pkgrm expect-5.40-sol8-sparc-local

or is the package instance not as simple as using the filename..?

You need to know the package name for expect and then

pkgrm <PKGNAME>

if using a SFW packackage the name will be something like SMCexpect.

Thank you so much...

If you don't know the package name, you should be able to get it from

pkginfo | grep -i expect

or something similar to that. Pkginfo lists all the installed packages so if you have a decent guess as to what it might be called you should be able to grep for it and find the exact name.

or

nawk '/expect/{print $NF}' /var/sadm/install/contents | sort -u

You can also use pkginfo on the original file to display various pieces of information about the package contained in it. For example:

pkginfo -d expect-5.40-sol8-sparc-local

Also when you add the package it tells you the name of the package it is installing.