Shell script for using yum command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script for using yum command
# 1  
Old 08-26-2015
Shell script for using yum command

Hi,

I want to downgrade or uninstall a package using yum, say Samba in rhel 6. All I want to write a shell script that is use to downgrade or uninstall that package using yum.

Can anyone please help me out?

Thanks in Advance
# 2  
Old 08-26-2015
Why do you need a script? Did you consult the man pages.
Code:
yum remove package
yum erase package
yum downgrade package

# 3  
Old 08-26-2015
Actually I want to uninstall/install a package using yum through shell scripting.
I tried using the above mentioned command but didn't work for me.
can you please send a proper code written in shell scripting?
I'll be highly thankful for your cooperation.
# 4  
Old 08-26-2015
If the command doesn't work from the command line, it's not likely to work from a script. Post the error you got.
# 5  
Old 08-26-2015
It is working fine from command line
but not from script.
# 6  
Old 08-26-2015
Quote:
Originally Posted by usamamirza
It is working fine from command line
but not from script.
That tells us nothing useful. We could guess all day at millions of things that might keep a script from working, but the chances that any of them would solve your problem are probably less than 1 in a billion.
  1. Show us the exact commands you are using on the command line that work (in CODE tags).
  2. Show us the exact contents of your shell script (in CODE tags).
  3. Show us exactly how you invoke your shell script (in CODE tags).
  4. Show us the exact output (including any diagnostic messages) produced by your shell script (in CODE tags).
With that information, we stand a MUCH better chance of being able to make suggestions that might help you resolve your problem.
# 7  
Old 08-27-2015
The error I'm facing is:

Code:
[root localhost Desktop]# ./remov.sh
bash: ./remov.sh: /bin/sh^M: bad interpreter: No such file or directory
[root localhost Desktop]# ]

I'm trying to run :
Code:
[root localhost Desktop]# yum remove -y samba

The content of my .sh file :
Code:
#!/bin/sh
#yum remove -y samba


Last edited by usamamirza; 08-27-2015 at 09:18 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Installation of virt-manager while yum update and yum install rhvm does not work

I have downloaded RHEV-H 4.2 Red Hat Virtualization - Red Hat Customer Portal (RHVirtualization 4.2 Host and Manager iso). I uploaded the image and installed on an HP G9 server baremetal. I found I dont have a WAN/net connectivity later on HPG9 server. How can I still install virt-manager on... (1 Reply)
Discussion started by: Paras Pandey
1 Replies

2. UNIX for Advanced & Expert Users

Yum install command -errors

i having this error message when installing a package using yum on red hat 7.2 Please see attachment (21 Replies)
Discussion started by: DOkuwa
21 Replies

3. Solaris

Yum, rpm, apt-get install command not found in Solaris

I am using solaris 10 yum command not found apt-get install command not found rpm command not found how to use yum and apt-get command in solaris how to install dhcp, openldap-servers packages in solaris (4 Replies)
Discussion started by: ainstin
4 Replies

4. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

5. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

6. Linux

Yum update/install script

Any one know of a way to do a yum -install and draw the argument of what to install from a text file? I have a huge list of rpms that I have to install on a bunch of machines and I would like to run one script that goes to each machine and installs all rpms in the list I have. (2 Replies)
Discussion started by: rd42
2 Replies

7. UNIX for Dummies Questions & Answers

Centos commands: Yum Upgrade versus Yum update

Hi, I would like to know the difference between YUM UPDATE and YUM UPGRADE. The man pages say upgrade is same as update with the obsolete option. And by default it says the obsolete option is turned on, which would make them equivalent. Does not say what obsolete does. Can someone please... (3 Replies)
Discussion started by: mojoman
3 Replies

8. Shell Programming and Scripting

Python script and yum

Hello to everyone:) This probably is a simple question here(hopefully), but i am trying to learn python, and after much googling cannot find an answer. How can i get yum command to work in the example below Hopefully this is in the right section, if not i apologise Dave (2 Replies)
Discussion started by: dave100
2 Replies

9. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

10. Red Hat

Yum command

Can anyone explain me the use of Yum command in Red hat. Even the rpm command is same as yum command. Let me know if any difference between yum and rpm (1 Reply)
Discussion started by: rogerben
1 Replies
Login or Register to Ask a Question