LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   package uninstallation by shell script (https://www.linuxquestions.org/questions/programming-9/package-uninstallation-by-shell-script-585471/)

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 pkg_upgrade.sh
#!/bin/sh

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.

try1:-

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

pkgrm: ERROR: no package associated with <y>

try 2:-


y pfexec /usr/sbin/pkgrm <PKGNAME>

./pkg_upgrade.sh: y: not found

try 3:-

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

./pkg_upgrade.sh: 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>
or
echo yes|fexec /usr/sbin/pkgrm <pkgname>

nik1984 09-19-2007 08:18 AM

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

Thanks to all.


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