-   Programming (
-   -   package uninstallation by shell script (

nik1984 09-18-2007 03:01 AM

package uninstallation by shell script
I am trying to uninstall package on solaris machine thru shell script.
while uninstallation i want to pass "yes + Enter" by command line.

sample shell script is as show below.

-bash-3.00$ cat

pkginfo -l PACKAGE1

pfexec /usr/sbin/pkgrm PACKAGE1 "yes"


I tried passing argument in double quotes like "yes" without any success.

any suggestions.

gnashley 09-18-2007 03:33 AM

Use the 'yes' program, something like this maybe:
yes pfexec /usr/sbin/pkgrm PACKAGE1

nik1984 09-18-2007 04:43 AM

still no success
i tried both things...not working.


pfexec /usr/sbin/pkgrm <PKGNAME> 'y'

pkgrm: ERROR: no package associated with <y>

try 2:-

y pfexec /usr/sbin/pkgrm <PKGNAME>

./ y: not found

try 3:-

'y' pfexec /usr/sbin/pkgrm <pkgname>

./ y: not found

colucix 09-18-2007 05:12 AM

You can try the -n (non-interactive) option to pkgrm and see if you get the expected result.

gnashley 09-18-2007 08:28 AM

"y: not found"
The command is 'yes' not 'y'

chrism01 09-19-2007 12:30 AM

echo y |fexec /usr/sbin/pkgrm <pkgname>
echo yes|fexec /usr/sbin/pkgrm <pkgname>

nik1984 09-19-2007 08:18 AM

" echo y |fexec /usr/sbin/pkgrm <pkgname> " command worked.

Thanks to all.

All times are GMT -5. The time now is 10:49 PM.