LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2007, 03:01 AM   #1
nik1984
LQ Newbie
 
Registered: Sep 2007
Posts: 7

Rep: Reputation: 0
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.
 
Old 09-18-2007, 03:33 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,902

Rep: Reputation: 589Reputation: 589Reputation: 589Reputation: 589Reputation: 589Reputation: 589
Use the 'yes' program, something like this maybe:
yes pfexec /usr/sbin/pkgrm PACKAGE1
 
Old 09-18-2007, 04:43 AM   #3
nik1984
LQ Newbie
 
Registered: Sep 2007
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 09-18-2007, 05:12 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
You can try the -n (non-interactive) option to pkgrm and see if you get the expected result.
 
Old 09-18-2007, 08:28 AM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,902

Rep: Reputation: 589Reputation: 589Reputation: 589Reputation: 589Reputation: 589Reputation: 589
"y: not found"
The command is 'yes' not 'y'
 
Old 09-19-2007, 12:30 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,814

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
echo y |fexec /usr/sbin/pkgrm <pkgname>
or
echo yes|fexec /usr/sbin/pkgrm <pkgname>
 
1 members found this post helpful.
Old 09-19-2007, 08:18 AM   #7
nik1984
LQ Newbie
 
Registered: Sep 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks

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

Thanks to all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 07:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 03:14 AM
I made a shortcut to a shell script and it is using default shell icon... shlinux Linux - Software 2 04-20-2006 07:29 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration